G
Greg Maxey
Jonathan West proposed a "DocumentBeforeSave" event handler as a
solution to a problem.
I have never messed with this sort of thing. I went in help and put
together the following code, but it doesn't seem to work. Can you
advise on what I am missing or doing wrong. Thanks.
This code is in a module in the Document Project:
Sub AutoOpen()
Dim X As New EventsClassModule
Set X.appWord = Word.Application
End Sub
This code is in a Class module name EventsClassModule
Option Explicit
Public WithEvents appWord As Word.Application
Private Sub appWord_DocumentBeforeSave _
(ByVal Doc As Document, _
SaveAsUI As Boolean, _
Cancel As Boolean)
Dim intResponse As Integer
intResponse = MsgBox("Do you really want to " _
& "save the document?", vbYesNo)
If intResponse = vbNo Then Cancel = True
End Sub
Nothing happens when I open the document and then save it.
solution to a problem.
I have never messed with this sort of thing. I went in help and put
together the following code, but it doesn't seem to work. Can you
advise on what I am missing or doing wrong. Thanks.
This code is in a module in the Document Project:
Sub AutoOpen()
Dim X As New EventsClassModule
Set X.appWord = Word.Application
End Sub
This code is in a Class module name EventsClassModule
Option Explicit
Public WithEvents appWord As Word.Application
Private Sub appWord_DocumentBeforeSave _
(ByVal Doc As Document, _
SaveAsUI As Boolean, _
Cancel As Boolean)
Dim intResponse As Integer
intResponse = MsgBox("Do you really want to " _
& "save the document?", vbYesNo)
If intResponse = vbNo Then Cancel = True
End Sub
Nothing happens when I open the document and then save it.