I need for a message to appear when a user closes a workbook. If the user clicks "YES" it opens a userform. I wrote the code in the "Workbook_BeforeSave" sub and the msg opens fine but when I click "Yes" my userform barely starts and the workbook closes.
Is there a way to suspend the workbook to close until I've finished using my userform.
Can someone please help
Is there a way to suspend the workbook to close until I've finished using my userform.
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Msg, Style, Title, Response
Msg = "Do you want to change the date?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "Change Date"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Load UserForm1
UserForm1.Show
End If
End Sub