I have Excel 2000
After reading some posts on these forums, I have written the following code.
This is the contents of my Personal.XLS file, ThisWorkbook object:
(If I delete the "Private" keyword, there is no change in behaviour)
And this it the contents of the Module1 object in Personal.xls :
When I launch Excel, it opens with a new empty file. I get a message box with "Hello Autpen" message. But when saving, I don't get the "Hello BeforeSave" message. Only get the standard save dialog box.
Why is my Workbook_BeforeSave macro not launched at all??
Well, in a special case it works. Namely, if after starting Excel I go to VB editor and then press Save, then the macro is launched and message box appears. It looks like VB editor must be open for the macro to fire.
After reading some posts on these forums, I have written the following code.
This is the contents of my Personal.XLS file, ThisWorkbook object:
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "Hello BeforeSave"
End Sub
And this it the contents of the Module1 object in Personal.xls :
Code:
Sub Auto_Open()
Application.EnableEvents = True
MsgBox "Hello Auto_Open"
End Sub
When I launch Excel, it opens with a new empty file. I get a message box with "Hello Autpen" message. But when saving, I don't get the "Hello BeforeSave" message. Only get the standard save dialog box.
Why is my Workbook_BeforeSave macro not launched at all??
Well, in a special case it works. Namely, if after starting Excel I go to VB editor and then press Save, then the macro is launched and message box appears. It looks like VB editor must be open for the macro to fire.