Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Before Close Event problem

Status
Not open for further replies.

Simmy

Technical User
Sep 7, 2002
27
GB
Can anyone help

I have put code in my personal workbook that runs a macro when the workbook is opened(On_Open event)and one to clean up when it closes(Before_Close event). The open event works perfect every time but I have found that if I close Excel with the X button in the top right hand corner my Before_Close event does not run. Is there any way around this.

Grateful for any help

Simmy123
 
try using a sub called auto_close instead of the before close private sub.

Sub Auto_close()

'stuff to do goes here.

end sub
 
Personal.xls must get special treatment from Excel (I duplicated your problem on my side). On the other hand, all my addins have beforeclose events that get handled just fine. So putting your code in an addin is another option. Pcfred's suggestion works just fine, though.
Rob
[flowerface]
 
Thanks guys

Will try auto close routine

Thanks again for your help & time

Simmy123
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top