How to confirm the user before exiting your application
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 | 'Forms - How to confirm the user before exiting your application Option Explicit 'When the user will try to end this program by clicking the X button, 'by pressing Alt + F4, or by any other way, a message box will pop up 'and will ask the user for confirmation. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") = vbNo Then Cancel = True End Sub |