PDA

View Full Version : Sleeper: Close Workbook and via Close Excel



MichaelH
06-08-2005, 05:40 AM
Hi Guys and Gals,

In the Close Event is there a way to tell if this is from the File / Close on the workbook, or from closing the Excel application?

The reason is, I have some code in an Add-In that is executed on the Close event, but I have found a known problem that during the Exel Application Close it unloads Add-Ins before all open spreadsheets are closed; thus depending on what other spreadsheets are being closed and timing, I get spurious fails.

I've already got code that checks that the Add-In exists before a module within it is called, but maybe the add-in unload is happening after that check returns the Add-In does exist.

Any ideas please?
thanks,
Michael

Jacob Hilderbrand
06-14-2005, 10:08 PM
I haven't ever seen a method of determining if the App is quiting or just one file. You can get some application level events with a class module, but there isn't a Quit event.

Can you add some code to the Addin Uninstall event? Maybe post an attachment or some code that illustrates the specific problem you are getting.

MichaelH
06-15-2005, 06:04 AM
Hi Jake,

I'm not sure what I could add to the Uninstall Event to stop the random fails.

The Bug I think is casuing this is described at http://support.microsoft.com/default.aspx?scid=kb;en-us;831200 . The final sentence in the Cause section apears to be what I am suffering: Because of this problem, COM Add-Ins can be prematurely unloaded before the actual application termination.

If this is correct, then I am trying to call a module in the Addin whilst that Addin is being uninstalled (but was there a nono-second ago).

Any other ideas?

thanks

Michael