- Code: Select all
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
' Only prompt if the user hits X
If UnloadMode = 0 Then
If Msgbox("Are you sure you want to quit?", vbYesNo Or vbQuestion) = vbNo Then Cancel = True
End If
End Sub



