Hello everyone,

I ve tried:
Private Sub Workbook_BeforeClose(cancel As Boolean)

Application.EnableEvents = False
ThisWorkbook.Save
Application.DisplayAlerts = False
Application.Quit

End Sub



It works fine when pressing X to the program but shutting down the computer give me the "save question".

I am using Office 2010.

Is there any other code I can try in Workbook_BeforeClose or even catch the" windows shutting down" somehow to run a sub?

thanks in advance