View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default 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?