I am using this code so that one sheet always shows when the workbook opens. It works if I click the red X to close and then select save. It doesn't work if I select FILE then CLOSE. It does run, but the file wont close, I can just keep selecting save over and over. What is the difference between the 2 different ways to close that would cause this?
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'BeforeSave code here
Run "HideAll"
Cancel = True 'cancels the users original save command request
Application.EnableEvents = False 'stops beforesave event from re-running
ActiveWorkbook.Save 'saves workbook just like user wanted
Application.EnableEvents = True
'After Save code here
Run "ShowAll"
End Sub