Microsoft KB Archive/324921

= Other programs do not work after you exit Outlook =

Article ID: 324921

Article Last Modified on 2/28/2007

-

APPLIES TO


 * Microsoft Office Outlook 2007
 * Microsoft Office Outlook 2003
 * Microsoft Outlook 2002 Standard Edition

-



This article was previously published under Q324921



SYMPTOMS
If you start Microsoft Outlook, run a second program (for example, Microsoft Visual Basic or a Microsoft Visual Basic for Applications program) that accesses Outlook, and then exit Outlook while you still have the second program running on your computer, you may experience one of the following symptoms:  You receive an error message that is similar to the following:

Microsoft Visual Basic Run-time error '462'

The remote server machine does not exist or is unavailable

 Another program that automates Microsoft Outlook does not work.



CAUSE
This behavior occurs because previous versions of Outlook allowed multiple instances to continue running after Outlook was closed. Outlook appeared to stop responding (hang) after you closed the program, when in fact a different program was still using Outlook.

To prevent this behavior, Microsoft Outlook 2002 and later versions of Outlook were designed to close all instances when you close the program.



WORKAROUND
Use one of the following methods to work around this behavior:  Start your custom program before you start Outlook. When you start the programs in this order, a reference is kept open for Outlook, and your custom program works as it did with previous versions of Outlook.  Modify your custom program code so that it traps for the error condition, and then reinitializes the Outlook object model.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements. The following example is a sample code for a button click that traps the error condition, and then reinitializes the Outlook object model: Sub CommandButton1_Click On Error Resume Next MsgBox ns.CurrentUser.Name If Err.Number <> 0 Then MsgBox Err.Description Set oL = CreateObject(&quot;Outlook.Application&quot;) Set ns = oL.Session MsgBox ns.CurrentUser.Name Err.Clear End If End Sub 

Additional query words: OL2K ol2002 ol2003 ol2007 hang hangs hanging hung lock up locks locking locked lockup freeze freezes freezing froze frozen stop stopping stopped won't respond waiting

Keywords: kberrmsg kbprb KB324921

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.