Log in

View Full Version : Sending Outlook Email to ReplyRecipients



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

bigal.nz
08-21-2016, 11:40 AM
Update: I have since found out that my code works on my personal computer - I think it might be something to do with a G.Policy @ work.