phillipclark
Board Regular
- Joined
- Sep 10, 2013
- Messages
- 65
Good afternoon All,
I am using the below code when the close button is used to ask the user a series of questions based on yes or no answers. This works fine and I have no issues. The problem i have is that excel will have the pop up asking the user to save the file. I am already using a macro and custom file name so i need to disable all of these request. What do i need to add to my code below in order to prevent this request from excel.
Thank You in advance for all your help.
I am using the below code when the close button is used to ask the user a series of questions based on yes or no answers. This works fine and I have no issues. The problem i have is that excel will have the pop up asking the user to save the file. I am already using a macro and custom file name so i need to disable all of these request. What do i need to add to my code below in order to prevent this request from excel.
Thank You in advance for all your help.
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If MsgBox("Have you saved the data?", vbYesNo) = vbYes Then Cancel = False
If MsgBox("Would you like to cancel close?", vbYesNo) = vbYes Then Cancel = True
End Sub