terminate the routine if outlook is not available

  • Thread starter Thread starter fitful_thought
  • Start date Start date
F

fitful_thought

This code forms part of a routine that will be running on some computers
that have Outlook 2003 and some that have Outlook Web Access for Exchange
2003.

DimOutAppAsOutlook.Application
DimOutMailAsOutlook.MailItem
SetOutApp=CreateObject("Outlook.Application")
SetOutMail=OutApp.CreateItem(olMailItem)

Can I add something to the above code to terminate the routine if outlook is
not available?

Please feel free to contribute is you have an ideas.
 
Am Thu, 27 Apr 2006 06:54:22 +1000 schrieb fitful_thought:

A simle error handler does the trick:

On Error Resume Next
Dim OutApp AsOutlook.Application
Dim OutMail AsOutlook.MailItem
Set OutApp=CreateObject("Outlook.Application")
If Not OutApp Is Nothing Then
Set OutMail=OutApp.CreateItem(olMailItem)
Else
' Not available
MsgBox Err.Description
Endif
 
Thank you Michael.
DL


Michael Bauer said:
Am Thu, 27 Apr 2006 06:54:22 +1000 schrieb fitful_thought:

A simle error handler does the trick:

On Error Resume Next
Dim OutApp AsOutlook.Application
Dim OutMail AsOutlook.MailItem
Set OutApp=CreateObject("Outlook.Application")
If Not OutApp Is Nothing Then
Set OutMail=OutApp.CreateItem(olMailItem)
Else
' Not available
MsgBox Err.Description
Endif
 
Back
Top