seems easy enough but for all the new guys... well basically it seems like something you might want to know.
Firstly put this is General Declarations...
Next we will go to "Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)", you could also use "Private Sub Form_Unload(Cancel As Integer\)" but I have been informed that the first way is cleaner...
So put this in "Form_QueryUnload"...
Now when you go to exit the program you will be promoted and when you click yes it will close and when no is clicked nothing will happen!
-Darthatron
Firstly put this is General Declarations...
Code:
Dim Response As Integer
Next we will go to "Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)", you could also use "Private Sub Form_Unload(Cancel As Integer\)" but I have been informed that the first way is cleaner...
So put this in "Form_QueryUnload"...
Code:
Response = MsgBox("Are you sure you want to exit?", vbYesNo, "Exit?")
If Response = vbYes Then
Cancel = 0
Else
Cancel = 1
End If
Now when you go to exit the program you will be promoted and when you click yes it will close and when no is clicked nothing will happen!
-Darthatron






