How do pause in Outlook.Quit

A

Andrey_R

I have a problem. In outlook's addins crash, if I close it before the
advanceSearch end. I do check in application.Quit. But outlook still close.
Then it open. And when search finish, it close again. I see it on my log. How
do I right?
 
K

Ken Slovak - [MVP - Outlook]

By the time application.Quit() fires the Outlook objects are already out of
scope. Probably you can check for the Explorer.Close() and Inspector.Close()
events on any open Explorer or Inspector and if it's the last Explorer
closing or last Inspector and there are no Explorers then use that as your
signal that Outlook is closing down.
 
A

Andrey_R

Thanks Ken. I do pause in Explorer.Close() and Inspector.Close(). But
Outlook still closed at once and when search finished, log write open and
close. Are objects in this metods already out of scope?
 
K

Ken Slovak - [MVP - Outlook]

Your Outlook objects aren't out of scope yet when Explorer.Close() and
Inspector.Close() fire. If you determine in those event handlers that
Outlook is closing and an advanced search is in progress just call its
Stop() method, then call a procedure to release all of your Outlook objects.
That should let Outlook close properly.
 
Top