Hi guys, I am trying to send an email via MS Access using VBA. I am using the below code:
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.
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: