bigal.nz
08-18-2016, 03:01 PM
Hello,
I am trying to send a email with an attachment, and set the ReplyTo address.
I am getting :
Runtime Error '287'
Application-defined or Object-defined error
On the line : .ReplyRecipients.Add "test@test.com"
'***************************************
' *** CLICK EVENT BUTTON - Email NG ***
'***************************************
Private Sub btn_NGProvider_email_Click()
GetUserFullName2
' *** SETUP OUTLOOK ***
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = New Outlook.Application
Set OutMail = OutApp.CreateItem(olMailItem)
' *** SETUP OTHER STUFF ***
...
' *** CREATE PDF ***
...
...
' *** CREATE EMAIL ***
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.Subject = "Referral - " & Me.Event
.Body = "FEEDBACK: "
If EmailAddress > 0 Then
.To = EmailAddress
End If
.Importance = olImportanceHigh
.Attachments.Add FileName
.ReplyRecipients.Add "test@test.com"
.Display
End With
' *** TIDY UP ***
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
What am I doing wrong?
Cheers
-Al
I am trying to send a email with an attachment, and set the ReplyTo address.
I am getting :
Runtime Error '287'
Application-defined or Object-defined error
On the line : .ReplyRecipients.Add "test@test.com"
'***************************************
' *** CLICK EVENT BUTTON - Email NG ***
'***************************************
Private Sub btn_NGProvider_email_Click()
GetUserFullName2
' *** SETUP OUTLOOK ***
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = New Outlook.Application
Set OutMail = OutApp.CreateItem(olMailItem)
' *** SETUP OTHER STUFF ***
...
' *** CREATE PDF ***
...
...
' *** CREATE EMAIL ***
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.Subject = "Referral - " & Me.Event
.Body = "FEEDBACK: "
If EmailAddress > 0 Then
.To = EmailAddress
End If
.Importance = olImportanceHigh
.Attachments.Add FileName
.ReplyRecipients.Add "test@test.com"
.Display
End With
' *** TIDY UP ***
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
What am I doing wrong?
Cheers
-Al