RobbieC
Active Member
- Joined
- Dec 14, 2016
- Messages
- 376
- Office Version
- 2010
- Platform
- Windows
Hi there, I have a workbook where I am exporting 'data inputted' instead of saving the workbook. I have all of this working fine apart from when a user closes the workbook. Usually, you'll get a prompt "Workbook not saved? Save Workbook?" with a yes/no/cancel option.
However I'm trying to save my 'data' instead of the 'workbook'. I can hijack the autoclose and launch my own userform with:
and on my userform 'SaveOnExit' I have 3 buttons - Save, Don't Save & Cancel
The Save and Don't Save buttons are not a problem because when I unload the userform, the Auto_Close() macro continues and the workbook closes, however I need to get the cancel button to exit the Auto_Close routine...
I have searched for a solution, but can't find anything... Is there a way to do this, or am I barking up the wrong tree with this method?
If you can point me in the right direction, that'd be brilliant. Thanks
However I'm trying to save my 'data' instead of the 'workbook'. I can hijack the autoclose and launch my own userform with:
Code:
Sub Auto_Close()
SaveOnExit.Show
ThisWorkbook.Saved = True
End Sub
The Save and Don't Save buttons are not a problem because when I unload the userform, the Auto_Close() macro continues and the workbook closes, however I need to get the cancel button to exit the Auto_Close routine...
I have searched for a solution, but can't find anything... Is there a way to do this, or am I barking up the wrong tree with this method?
If you can point me in the right direction, that'd be brilliant. Thanks