Execute code on Save

How do I call a macro each time I save a workbook?
fitalianoAsked:
Who is Participating?
 
kgerbConnect With a Mentor Chief EngineerCommented:
did you put it in the "workbook" module?  It won't work if you put it in a normal module.

code for workbook events goes in here
Kyle
0
 
kgerbChief EngineerCommented:
Put this in the workbook module.  Change MyMacro to the name of the procedure you want to call.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Call MyMacro
End Sub

Open in new window


Kyle
0
 
Mike EghtebasDatabase and Application DeveloperCommented:
0
 
fitalianoAuthor Commented:
The suggested code doesn't work.  I put a breakpoint and it skips the routine.  Any suggestion?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.