Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro before saving file
How can I run a macro automatically right before saving a file. So all the user had to do is to click on save and the macro will run.?
Thank E.B. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro before saving file
There is a workbook event called BeforeSave. Call you macro in this event
code. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Einollah2001" wrote in message ... How can I run a macro automatically right before saving a file. So all the user had to do is to click on save and the macro will run.?? Thanks E.B. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro before saving file
Hi
you can use the workbook Beforesave event. enter the following in your workbook module Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Msgbox "Will save now" 'enter your code here End Sub Frank Einollah2001 wrote: How can I run a macro automatically right before saving a file. So all the user had to do is to click on save and the macro will run.?? Thanks E.B. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro before saving file
Here is what you need to do
1) in the project explorer window, click on "This Worbook" 2) Select "Workbook" in the objects dropdown list 3) Select "BeforeSave" in the events list. 4) the following headers should appear automatically Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel A Boolean) End Sub insert all code between these lines. IF you want to call a procedur simply type in call (procedure name -- Message posted from http://www.ExcelForum.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro before saving file
Use the BeforeSave event
Not familiar with events? See Chip Pearson's page on the topic http://www.cpearson.com/excel/events.htm -- regards, Tom Ogilvy Einollah2001 wrote in message ... How can I run a macro automatically right before saving a file. So all the user had to do is to click on save and the macro will run.?? Thanks E.B. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Running macro on file open | Excel Discussion (Misc queries) | |||
Excel 2007 one network file running (loading and saving) slow | Excel Discussion (Misc queries) | |||
Macro Help for Saving a file | Excel Worksheet Functions | |||
How to stop getting the file save box when running a macro | Excel Discussion (Misc queries) | |||
Saving a new file with a macro | Excel Programming |