View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Lasse[_2_] Lasse[_2_] is offline
external usenet poster
 
Posts: 15
Default Run macro before closing Excel 2007

So far thanks for your input, it's greatly appreciated! Maybe I should get a
profile on your site :-)

The only reason I want to uninstall the add-in is to avoid getting a
build-in error message from Excel if the add-in.xlam file is missing when
opening Excel. The build-in message appears before Excel runs the content of
ThisWorkbook so I assume that I can't suppress it.

I have just tried adding the following to ThisWorkbook in Personal.xlsb:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
AddIns("Add-in").installed = False
Msgbox "Add-in uninstalled"
End Sub

But it never executes it when closing a worksheet og Excel?

/Lasse