-
Problem with exit prompt
I have a problem with some code that i cant figure out whats is wrong. here it is:
Code:
Private Sub mnuExit_Click()
MsgBox "Do you really want to exit", vbYesNo, "Exit"
If vbYes Then
End
Else
Cancel = 1
End If
End Sub
When you click "Yes" it exits. When you click "no" it exits. what am i doing wrong. (keep in mind that i am a beginner)
-Steve
-
I fixed your code:
Code:
Private Sub mnuExit_Click()
Dim Respons As Long
Respons = MsgBox "Do you really want to exit", vbYesNo, "Exit"
If Respons = vbYes Then
End
Else
Cancel = 1
End If
End Sub
-
-
Or use this.
Code:
If MsgBox("Do you want to exit", vbYesNo) = vbYes Then
Unload Me
End If