Is there a DocumentAfterSave event?

D

David Thielen

Hi;

Is there an event after a document is saved or when a document is renamed?
 
P

Peter Huang [MSFT]

Hi Dave,

All the event exposed by word is listed in the word vba helper file.
Here is an event may have some help.
DocumentBeforeSave Event

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

David Thielen

Hi;

The problem is I need to know the name of the document if it gets changed.
So at the DocumentBeforeSave - if the file has never been saved or the user
renames it - it still has the old name. I need the new name.

I went through all of the events and didn't see anything. But it strikes me
that this would be a somewhat common need so I am hoping there is an event
somewhere and I just didn't find it.

Are you aware of anything that will tell me that the file's name has changed
or the save has completed?
 
P

Peter Huang [MSFT]

Hi

Word do not expose the aftersave event.
But we can handle DocumentBeforeSave to cancel the default dialog and show
ourselves'.
e.g.

Private Sub wdApp_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As
Boolean, Cancel As Boolean)
SaveAsUI = False
Cancel = True
Dim dlg As Dialog
Set dlg = Application.Dialogs(wdDialogFileSaveAs)
Dim i As Long
i = dlg.Show()
Debug.Print Doc.FullName
End Sub

You may have a try.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

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.

Ask a Question

Top