Run Macros after a certain action is taken.
Right click the Excel icon on the menu bar at the top left and select view
code. This will take you to the VBE window in the ThisWorkbook module. There
are 2 drop downs menus just abopve the code window. One will say general and
the other declarations. Chnge the one that says general to Workbook. Now the
one that said declarations will show you all of the workbook events that you
can use. Select BeforeClose and a code stub will be added, something like this
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Call MyMacro 'Add your code here
End Sub
--
HTH...
Jim Thomlinson
"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?
|