But that way of doing things does let you know if you tapped into an
existing instance of Outlook or created a new instance. Very useful if you
want to know whether or not to terminate the Outlook process when your code
is finished.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"Stefan Hoffmann" wrote in message
...
hi Norman,
Norman Yuan wrote:
On Error Resume Next
Set OutlookApp = GetObject(,"Outlook.Application")
If Err.Number0 Then
Err.Clear
Set OutlookApp=CreateObject("Outlook.Application")
If Err.Number0 Then
MsgBox "Cannot get Outlook"
Exit Sub
End If
End If
Due to the nature of Outlook, it is a single instance application, you
don't need the error trapping. The CreateObject will return the existing
instance or start a new one.
mfG
-- stefan --