Hello
I've created a VBA program and have included an EXIT button on a userform. I expect the EXIT button to prompt the user with the message "Do you wish to save the changes to this workbook" to confirm press YES or NO. If the user clicks YES then the program is saved and closed. If the user clicks NO the program/excel is closed down without saving.
This is what I have so far:
Private Sub CommandButton3_Click()
Dim MsgBoxResult As Long
MsgBoxResult = MsgBox("Do you wish to save the changes to this workbook" & vbCr & _
vbYesNoCancel)
If MsgBoxResult = vbCancel Then
Application.DisplayAlerts = False
Application.Quit
ElseIf MsgBoxResult = vbYes Then
ThisWorkbook.Save
Application.DisplayAlerts = False
End If
End Sub
When I click the EXIT button, the message pops up with an OK button but not a YES and NO button.
Any ideas??? Any help would be great!
Thanks all
Bookmarks