MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Trigger Macro when "Save As" selected?


Posted by Christopher Patrick on January 09, 2002 12:41 PM

HI all-

Is it possible to trigger a macro to run when a user selects "File->Save As", or "File->Save"?

Thanks for any help.

Chris


Posted by malcolm stewart on January 09, 2002 1:05 PM

In the "Thisworkbook" code sheet add:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "you're trying to save me"
End Sub
You can also do this by opening the thisworkbook code sheet and using the dropdown boxes at the top of the page firstly from General to thisworkbook and the righthand one to the sheet event beforesave.