ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run macro when file closes (https://www.excelbanter.com/excel-programming/403418-run-macro-when-file-closes.html)

Patrick C. Simonds

Run macro when file closes
 
I need to run a macro every time my workbook close. Can this be done?

Gary Keramidas

Run macro when file closes
 
in the vb editor, double click the "thisworkbook" entry under microsoft excel
objects and select workbook from the dropdown and then before close from the
event dropdown

Private Sub Workbook_BeforeClose(Cancel As Boolean)
' your macro
End Sub

or use

sub auto_Close()
' your macro
end sub

in a general module
--


Gary


"Patrick C. Simonds" wrote in message
...
I need to run a macro every time my workbook close. Can this be done?





All times are GMT +1. The time now is 07:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com