Invalid Explorer objects

M

Marius Seglsten

I am trying to develope an AddIn for Microsoft Outlook where I wish to
add a CommandBar to the Explorer objects. I am using Visual Studio
..NET 2003.

I have two problems, depending on the version of Office that I am
running.
Outlook XP (2002):
When calling Application.ActiveExplorer() I always get an error saying
"The explorer has been closed and connot be used for further
operations". The same thing happens when trying to receive
notification of new Explorer instances by using the "NewExplorer"
event.

Outlook 2003:
In Outlook 2003 the Application.ActiveExplorer() works fine, but when
accessing the Explorer object recieved from the "NewExplorer" event, I
get the same error as in Outlook XP ("The explorer has been closed and
connot be used for further operations") in some situations:
1: When starting Outlook by running the executable, everything is ok.
2: When the Outlook process has been started by an external
application (like CreateObject("Outlook.Application")) the error
occurs.

I have tried a lot of different things, and nothing seems to work. I
have searched after others with similar problems, but haven't found
anyone at all. Please help!

Best regards,
Marius Seglsten
 
K

Ken Slovak - [MVP - Outlook]

When Outlook has been started using automation it may not have any Explorers
at all. That's the situation for example when ActiveSynch starts Outlook.
Normally, one would check for Explorers.Count > 0 to see if that's the case.
In fact, at any time when you are checking for Explorers you can check for
that to see if there are any Explorers. If not then there can't be an
ActiveExplorer.

Beyond that I'd suggest looking at the .NET Outlook coding information at
http://www.microeye.com/resources/res_outlookvsnet.htm. If you are using
VB.NET see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnout2k2/html/odc_oladdinvbnet.asp
for some good code samples.

One thing you might want to look at is how that code works with
ActiveExplorer:
'Type conversion is required due to "ambiguous name" issue.
m_olExplorer = CType(m_olOutlook.ActiveExplorer, Outlook.ExplorerClass)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top