Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error No-48 - Object doesn't support - Outlook 2000

Status
Not open for further replies.

justagrunt

Technical User
Oct 10, 2002
132
0
0
Hi,
Automating an email but found that .quit etc closed the already running session, so tried the following only to get an error 48 - Object doesn't support this property or method.
Is it possible to check for a already running instance use it but not destroy it or if not, create and then close.

Dim fisOutlookrunning As Boolean

'create variables for Outlook

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

'create an Outlook instance to use for the email message: uses
'the existing Outlook instance if there is one, otherwise creates
'a new instance.
On Error Resume Next

Set objOutlook = GetObject(, "Outlook.Application")
If Err.Number = 429 Then
fisOutlookrunning = False
'Outlook is not running; create an Outlook object
Set objOutlook = CreateObject("Outlook.Application")

Err.Clear
Else
'use current Outlook object
fisOutlookrunning = True
End If

Set objEmail = objOutlook.CreateItem(olMailItem)

'Sets up error handler for the rest of the procedure
On Error GoTo Err_messageError

'close Outlook
Set objEmail = Nothing

' quit the instance of Outlook in use.

objOutlook.Quit
Set objOutlook = Nothing

Err_messageError:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description

End Sub

Warm Regards
Bill
 
You don't test fisOutlookrunning to avoid closing the already running session.
Which line raises the 438 error ?


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi,
Good question.
At this stage I would guess at something after
'Sets up error handler for the rest of the procedure
On Error GoTo Err_messageError

Haven't set a line trap as yet.
Warm Regards
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top