438 error sending Outlook e-mail

J

JamesDeckert

I'm getting an error sending e-mails using Outlook. It works fine with
Outlook 2002, but I'm getting a 438: Object doesn't support this property or
method from the Outlook 2000 system.

I'm late binding the Outlook object to help remove incompatibility issues.
I'm using Outlook so I can send HTML e-mails.

Does anyone know if there is something in my code which is not compatible
with Outlook 2000?

Following is my code.
Sub SendEMail(strRecipient As String, strSubject As String, strBody As String)
Dim objOutlook As Object
Dim objMsg As Object

Set objOutlook = CreateObject("Outlook.Application")
Const olMailItem = 0
Set objMsg = objOutlook.CreateItem(olMailItem)
strBody = Replace(strBody, vbCrLf, "<br>")
Const olFormatHTML = 2
With objMsg
.To = strRecipient
.Subject = strSubject
.BodyFormat = olFormatHTML
.HTMLBody = strBody
.Send
End With

Set objOutlook = Nothing
Set objMsg = Nothing
end sub
 

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