Running a macro "On Save"

H

heski

Hi,

Can anyone tell me how I can get a file to run a macro each time th
file is saved. I know this is achievable but can't find how to do it.

Thanks in advance for any assistance
 
P

papou

Hello
Use this workbook event which fires before saving workbook :
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
If Not Cancel Then
'do your stuff here
End If
End Sub

To acces this event either right-click on the Excel icon immediately
situated left to th File Menu in Excel
or open VB Editor and double-click on Thisworkbook

HTH
Cordially
Pascal
 
C

CLR

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.Run "PutYourMacroNameHere"
End Sub

Vaya con Dios,
Chuck, CABGx3
 
Top