Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use the workbooks BeforeClose event to call your macro.
See Chip Pearson's Overview page on events http://www.cpearson.com/excel/events.htm You would go to the VBE, in the project explorer, under your workbook, right click on Thisworkbook and select view code. At the top of the module will be two dropdowns. From the left dropdown, select Workbook and from the right dropdown Select BeforeClose. (or you might want to use BeforeSave - only you would know which is correct) this will put in the declaration for the procedu Private Sub Workbook_BeforeClose(Cancel As Boolean) End Sub You would call your macro he Private Sub Workbook_BeforeClose(Cancel As Boolean) Mymacro End Sub -- Regards, Tom Ogilvy "Precise Eng" wrote: I have written a macro that I use a lot and I always use it when I am closing the document. Is there a way that I can have the macro run automticly when I close the document? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excell copy action pauses for 15 second for the smallest action | Excel Discussion (Misc queries) | |||
Allow no action to be taken | Excel Worksheet Functions | |||
On Action | Excel Programming | |||
OLE action? | Excel Programming | |||
an OLE Action | Excel Programming |