DocumentBeforeSave Event Example

This example prompts the user for a yes or no response before saving any document.

Private Sub App_DocumentBeforeSave _
        (ByVal Doc As Document, _
        ByVal SaveAsUI As Boolean, _
        Cancel As Boolean)
    a = MsgBox("Do you really want to " _
        & "save the document?", _
        vbYesNo)
    If a = vbNo Then Cancel = True
End Sub