RobbieC
Active Member
- Joined
- Dec 14, 2016
- Messages
- 376
- Office Version
- 2010
- Platform
- Windows
Hi there, I have a 'very customised' spreadsheet which I have replaced all alert boxes with customised userforms.
I have a form called CloseAreYouSure which is triggered when Auto_Close kicks in. This just confirms whether or not the application is to close down with a 'yes' & 'no' button:
If the user chooses 'yes', the sub continues and the program shuts down without the final prompt 'save', don't save' or 'cancel'
But if the user chooses 'no' the Exit Sub doesn't kick in and instead the built-in 'save', don't save' or 'cancel' form appears...
Is there a way of cancelling the Auto_Close without the second 'alert' showing? Or is there a better way to do this?
If you can point me in the right direction, I'd be very grateful
Thanks
Rob
I have a form called CloseAreYouSure which is triggered when Auto_Close kicks in. This just confirms whether or not the application is to close down with a 'yes' & 'no' button:
Code:
Sub Auto_Close()
CancelAreYouSure.Show
If CancelForm = False Then
Exit Sub
End If
Application.DisplayAlerts = False
ThisWorkbook.Saved = True
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub
If the user chooses 'yes', the sub continues and the program shuts down without the final prompt 'save', don't save' or 'cancel'
But if the user chooses 'no' the Exit Sub doesn't kick in and instead the built-in 'save', don't save' or 'cancel' form appears...
Is there a way of cancelling the Auto_Close without the second 'alert' showing? Or is there a better way to do this?
If you can point me in the right direction, I'd be very grateful
Thanks
Rob