View Single Post
  #5  
Old July 18th 06, 07:02 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook.application startup differences Outlook 200 vs 2003 Please help ;-)

Hmm. Normally I would expect GetObject used that way to not create a new
instance of Outlook but to return Nothing if no object was running. Then I'd
use CreateObject. I certainly would not use both New and CreateObject. I'm
not sure about that Try...Catch block. What you really want to do is test
for the OL object being Nothing after using GetObject and then use
CreateObject if needed. Then I'd test for the OL object not being Nothing
before trying to get the NameSpace object.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dikbill" wrote in message
. ..
Ken,

Thnx again.
I've tried the 'GetObject' method, sorry for not mentioning that in my
question,
and that seems to work because when an Outlook.exe is running, that
instance of Outlook is put in the variable which I use. olApplication
If no Outlook.exe is running a new one will be started, invisible.

Dim olApplication as object = Nothing
Try

olApplication = GetObject(, "Outlook.Application")

Catch

olApplication = New Outlook.Application

olApplication = CreateObject("Outlook.Application")

End Try


But then when I want to do the next:


Dim olns as object = olApplication.getNamespace("MAPI")
Then I get the error
Exception from HRESULT: 0x800A9C64

Do you have a clue???

Right now I'm re-installing office 2000, because maybe something has
become corrupt or something.

Tx,

Dikbill, The Netherlands


Ads