Run Marco OnSave??

S

Scamp

Is there a way to trigger an excel macro anytime a file is saved?

I've tried OnSave() and OnFileSave() with no luck, and google is
letting me down today....
 
B

Bob Phillips

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
'your code
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)
 
S

Scamp

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
'your code
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

Bob:

That not only worked like a charm, it also opened my eyes to a entire
set of options I'd never run across before.

Bravo!

Thanks.
 
Top