Run Marco OnSave??

  • Thread starter Thread starter Scamp
  • Start date Start date
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....
 
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)
 
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.
 
Great, you should have loads of fun exploring them <G>

Regards

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top