Andrew Kennard was telling us:
Andrew Kennard nous racontait que :
Hi all
Word 2003 seems to have very few events to react upon ?
There is a BeforeSave but no "AfterSave"
I would likr to be able to copy the document to a folder when I 'flip
back' to my application (if it has changed)
Has anyone done anything similar ?
Thanks
Andrew
Intercept the Save and Save As commands with macros named like this:
'_______________________________________
Sub FileSave()
End Sub
'_______________________________________
'_______________________________________
Sub FileSaveAs()
End Sub
'_______________________________________
Use code to do the save, and then do what you want to do. No need of events,
and if you want this to be global event try with a template located in the
Start-up folder
Normally, I use a third sub that actually does the work:
'_______________________________________
Sub FileSave()
SaveEvent 1
End Sub
'_______________________________________
'_______________________________________
Sub FileSaveAs()
SaveEvent 2
End Sub
'_______________________________________
'_______________________________________
Sub SaveEvent(lngSaveType As Long)
If lngSaveType = 1 Then
ActiveDocument.Save
Else
Dialogs(wdDialogFileSaveAs).Show
'In fact, you need more code here in case the user cancels out of that
dialog,
' you have to code accordingly
'See the VBA help file on Dialogs. Or do a Search in Google Groups,
'there are may example on how to do this
'If the document was not successfully saved with Save As:
Exit Sub
End if
'Do the stuff you want to do after the save here
End Sub
'_______________________________________
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org