• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Execute code on Save

How do I call a macro each time I save a workbook?
0
fitaliano
Asked:
fitaliano
  • 2
1 Solution
 
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
 
kgerbChief 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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now