I am unable to send my email out.

Nishikawa

Registered User.
Local time
Today, 02:32
Joined
May 17, 2007
Messages
97
Hi guys, I am trying to send an email via MS Access using VBA. I am using the below code:

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = strbody
.Attachments.Add FileNameZip
.Save 'or use .Display
.Display
.Send
End With

Set OutMail = Nothing
Set OutApp = Nothing
Set oApp = Nothing

MS Access give me this error "Run-time error '287', Application-defined or object-defined error" when it runs to ".send"

I have add outlook object in my reference.

please help.

thanks.
 
Last edited:
I took this line and it worked for me (changed the email address to myself)

".Attachments.Add FileNameZip"
 
That line works. ".send" does not.
 
I took out ".attachment", ".save", ".display" and it still does not work
 
its working fine here.. i think it's got to do with your MS Outlook..
 
it is a modified MS outlook for company purposes. If it is working at your side, I will have to find another way to send email via access. Thanks for everybody's help.
 

Users who are viewing this thread

Back
Top Bottom