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]
>>
>.