OnBeforeSave Event
Occurs before a page in an active extended page window is saved.
Private Sub expression_OnBeforeSave(SaveAsUI As Boolean, Cancel As Boolean)
expression A variable name that references an object of type PageWindowEx declared using the WithEvents keyword in a class module.
SaveAsUI A Boolean that determines if the user interface will be displayed. If True, the Save As dialog box will be displayed.
Cancel A Boolean that determines if the save operation will be cancelled. If True, the document will not be saved.
Example
The following example prompts the user before saving the document. If the user clicks No, the document will not be saved. If the user clicks Yes, the document will be saved.
Private Sub PageWindowEx_OnBeforeSave(SaveAsUI As Boolean, Cancel As Boolean)
'Prompt user before saving the document
Dim strAns As String
strAns = MsgBox("Do you really want to save the document?", vbYesNo)
'Change cancel value based on user input
If strAns = VbNo Then
Cancel = True
End If
End Sub