Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2005

Tip: Looking for answers? Try searching our database.

Can I force a SAVE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave - 08 Apr 2005 14:17 GMT
Hi

I have designed some Word userform templates (based on
Word 2000) and I am wondering if I can force people to
Save a document as soon as it has been generated, and
before they begin to add additional text to the document
etc.

I am very much a newbie, so if this is possible, I would
appreciate lots of detail on how to please!  Sample code
would be even better!

Thanks

Dave
Chuck - 08 Apr 2005 16:37 GMT
If you put this code in the ThisDocument module of your template it will
execute when a user tries to create a document based on the template:

Private Sub Document_New()

 On Error GoTo errorhandler:

 ActiveDocument.Save

 errorhandler:

   Select Case Err.Number
     Case 4198 'command failed
       MsgBox "You must save before continuing.", _
       vbExclamation, _
       "Save required"
       ActiveDocument.Close wdDoNotSaveChanges
     Case Else
       MsgBox Err.Number & " " & Err.Description
   End Select

End Sub

> Hi
>
[quoted text clipped - 11 lines]
>
> Dave
Dave - 08 Apr 2005 19:26 GMT
Many thanks Chuck

>-----Original Message-----
>If you put this code in the ThisDocument module of your template it will
[quoted text clipped - 37 lines]
>>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.