G
Guest
Is it possible to set up a macro to run when a document is first saved (and
not everytime it is subsequently saved)? Thanks.
not everytime it is subsequently saved)? Thanks.
Is it possible to set up a macro to run when a document is first saved (and
not everytime it is subsequently saved)? Thanks.
so all may benefit.Jay Freedman said:Not exactly, but you can achieve the same effect. Write the macro to
do whatever you want on the first save, and include this as the first
line of the macro:
If Len(ActiveDocument.Path) > 0 Then Exit Sub
When a document is new and never saved before, its .Path parameter is
an empty string with a length of zero. Once it has been saved, the
.Path is the complete path from the disk letter to the folder where it
was saved. So with this line in place before any other actions, if the
document has been saved the macro will exit immediately and not do
anything else.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup
so all may benefit.Jay Freedman said:It's counterintuitive, but the answer is no. Although the first save
behaves like FileSaveAs (opening the Save As dialog), it doesn't
actually execute a FileSaveAs command, so that macro wouldn't run.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.