![]() |
Multiple Instances of Outlook
I am writing an application that works with Outlook - creating an instance
of "Outlook.Application" and find that by making Outlook visible it leaves the instance of Outlook open when I release the reference to the application. I make it visible by Dim inboxFolder As Outlook.MAPIFolder Set inboxFolder = gOutlookApp.GetNamespace("MAPI").GetDefaultFolder( olFolderInbox) inboxFolder.Display Is there a way to hide Outlook again, or ensure that when I release the instance of the object that instance of Outlook will close? I can call the Quit method, but this appears to close all instances of Outlook. Note the reason I am making Outlook visible is because for some reason some installs of Outlook 2000 do not appear to work with COM unless the application is visible. When processing mail I get a message "Could not open the item" - this message does not appear if the application is visible. Note I have also tried using GetObject instead of CreateObject but this appears to make no difference - it still creates a new instance of the application. |
Multiple Instances of Outlook
Instead of calling inboxFolder.Display, you can have something like
set Explorer = inboxFolder.GetExplorer Explorer.Display ..... Explorer.Close The error is an indication that you never call Namespace.Logon. After creating an instance of Outlook.Application, add set NS = Application.GetNamespace("MAPI") NS.Logon If you get that error from Namespace.GetItemFromID, make sure you also pass the store id as thee second (optional) parameter. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "John Mann" wrote in message ... I am writing an application that works with Outlook - creating an instance of "Outlook.Application" and find that by making Outlook visible it leaves the instance of Outlook open when I release the reference to the application. I make it visible by Dim inboxFolder As Outlook.MAPIFolder Set inboxFolder = gOutlookApp.GetNamespace("MAPI").GetDefaultFolder( olFolderInbox) inboxFolder.Display Is there a way to hide Outlook again, or ensure that when I release the instance of the object that instance of Outlook will close? I can call the Quit method, but this appears to close all instances of Outlook. Note the reason I am making Outlook visible is because for some reason some installs of Outlook 2000 do not appear to work with COM unless the application is visible. When processing mail I get a message "Could not open the item" - this message does not appear if the application is visible. Note I have also tried using GetObject instead of CreateObject but this appears to make no difference - it still creates a new instance of the application. |
All times are GMT +1. The time now is 11:28 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com