View Single Post
 
Old 02-16-2023, 11:46 PM
elaineAda elaineAda is offline Windows XP Office 2010
Novice
 
Join Date: Mar 2019
Posts: 25
elaineAda is on a distinguished road
Default How to remove the 'cancel' function when user clicks the 'X' button?

Is there a way to remove the Cancel button when the user clicks the "X" button in the upper-right corner of the Word window


I wrote the following but it didnt seem to work

Code:
Private Sub Document_BeforeClose(Cancel As Boolean)
    If ActiveDocument.Saved = False Then
        Select Case MsgBox("Do you want to save changes to this document?", vbYesNo + vbExclamation + vbDefaultButton1, "Microsoft Word")
            Case vbYes
                ActiveDocument.Save
            Case vbNo
                'Do nothing
        End Select
    End If
End Sub



Pl assist. Thanks.
Reply With Quote