Predicting that Excel is closing using events

  • Thread starter Thread starter Todd Webb
  • Start date Start date
T

Todd Webb

I am trying to monitor Excel behavior through events. To
do this I register with Application. If the end-user
manually closes Excel and my registration is still
active, the Excel process stays around in an un-dead
state until my process exits.

Suppose that I have Excel open with no open workbooks. If
the user closes Excel, I don't get any events. How do I
figure this out in time to remove my registration before
Excel tries to exit and hangs?
 
Hi Todd,

Unfortunately, there is no good answer to this. Excel doesn't expose any
events that would notify a controlling application that it's shutting down.
The best you can do is stash its window handle and always verify that you
can find an instance of Excel with that window handle before attempting to
do anything with your references. If you can't then set them all to nothing
and hope that takes care of it.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 
Back
Top