JGravesNBS
Registered User.
- Local time
- Yesterday, 23:24
- Joined
- Apr 5, 2014
- Messages
- 58
I have the following Sub that works OK in Access 2000
However when I run the same Sub in Access 2007 I get the following error on the .Send command:
Run-time '287':
Application-defined or object-defined error
I have a reference to:
Microsoft Outlook 12.0 Object Library
However when I run the same Sub in Access 2007 I get the following error on the .Send command:
Run-time '287':
Application-defined or object-defined error
I have a reference to:
Microsoft Outlook 12.0 Object Library
Code:
'Send Email through Outlook
Private Sub Command20_Click()
Dim mess_body As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
'06/22/16 does not support this
'.BodyFormat = olFormatRichText
'.BodyFormat = olFormatHTML
.To = Me.Email_Address
.Subject = Me.Mess_Subject
.HTMLBody = Me.Mess_Text
If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
.Attachments.Add (Me.Mail_Attachment_Path)
End If
'.DeleteAfterSubmit = True 'This would let Outlook send the note without storing it in your sent bin
[COLOR="Yellow"].Send[/COLOR]
End With
'MsgBox MailOutLook.Body
Exit Sub
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
Resume Error_out
Error_out:
End Sub