I really don't know the syntax of the DocumentBeforeClose event. Following this page, I should create a class module called 'EventClassModule' (see also this article). So I did. Then I copied this piece of code (from the example of the first link) into that (class)module:
Public WithEvents appWord as Word.Application
Private Sub appWord_DocumentBeforeClose _
(ByVal Doc As Document, _
Cancel As Boolean)
Dim intResponse As Integer
intResponse = MsgBox("Do you really " _
& "want to close the document?", _
vbYesNo)
If intResponse = vbNo Then Cancel = True
End Sub
And finally I put this in a normal module, and executed it:
Dim X As New EventClassModule
Sub Register_Event_Handler()
Set X.App = Word.Application
End Sub
What does the 'X' means in this case, and what am I doing wrong? There is no event executed when I close the document now.