OL2000: Outlook Won't Fully Exit Using COM Add-in

ID: Q208332


The information in this article applies to:
  • Microsoft Outlook 2000


SYMPTOMS

You create an Outlook COM Add-in, but Outlook does not fully quit when you click Exit on the File menu.


CAUSE

This typically happens when you use an Explorer or Inspector object variable and it is not properly released by the COM Add-in.

When the OnBeginShutdown event fires in the COM Add-in, the forms (Inspectors) and folder windows (Explorers) have already been closed. Therefore it is impossible to set these objects to Nothing using the COM Add-in's OnDisconnect or OnBeginShutdown events, since the object variables are no longer valid, and will generate errors if used.


RESOLUTION

Implement the Close event for the Explorer or Inspector object, and then set the corresponding object variable to Nothing at the end of that event.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp
The following code segment illustrates how you can declare an Explorer object WithEvents and implement the corresponding Close event that will fire just before the Explorer window closes.

Public WithEvents oMyExplorer As Outlook.Explorer

Sub oMyExplorer_Close()
    ' Release the Explorer object 
    Set oMyExplorer = Nothing
End Sub 


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.


REFERENCES

For additional information about available resources and answers to commonly asked questions about Microsoft Outlook 2000 solutions, please see the following article in the Microsoft Knowledge Base:

Q146636 OL2000: Questions About Custom Forms and Outlook Solutions

Additional query words: OutSol OutSol2000 OL2K

Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: November 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.