You can't fully quit Outlook when you use a COM Add-in in Outlook 2002

This article has been archived. It is offered "as is" and will no longer be updated.
For a Microsoft Outlook 2000 version of this article, see 208332.
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 Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMSThe 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.ExplorerSub oMyExplorer_Close()    ' Release the Explorer object     Set oMyExplorer = NothingEnd Sub				
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
References
For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:
287530 OL2002: Questions About Custom Forms and Outlook Solutions
OutSol OutSol2002
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 294867 - Last Review: 01/12/2015 18:02:44 - Revision: 1.0

  • Microsoft Outlook 2002 Standard Edition
  • kbnosurvey kbarchive kbaddin kbnewfile kbprb KB294867
Feedback