I am trying to figure out how to attach a PDF document to an Outlook email using VBA. This is a project for the Customer Service Representatives at the company I work for.
They receive this PDF into their Outlook inbox. Is there a way I can reference the title of this email (perhaps in a cell) so that the PDF attachment is added to the email my program is sending out? Or forwarded along with the email?
I really appreciate any help anyone can offer. I have no idea where to start.
Sub RFAEmail()
Current Code:
Dim OutApp As Object Dim OutMail As Object Dim strbody As String Dim strbody1 As String Dim strbody2 As String Dim strbody3 As String Dim strbody4 As String Dim strbody5 As String Dim strbody6 As String Dim strbody7 As String Dim strbody8 As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody1 = "" & Space(1) & Range("B5")
strbody2 = "Customer:" & Space(1) & Range("C5")
strbody3 = "" & Space(1) & Range("D5")
strbody4 = "Current:" & Space(1) & Range("E5")
strbody5 = "Proposed:" & Space(1) & Range("F5")
strbody6 = "Changes:" & Space(1) & Range("H5")
strbody7 = "Other Notes:" & Space(1) & Range("I5")
strbody8 = "PDF" & Space(1) & Range("G5")
strbody = strbody1 & vbNewLine & strbody2 & vbNewLine & strbody3 & vbNewLine & strbody4 & vbNewLine & strbody5 & vbNewLine & strbody6 & vbNewLine & strbody7 & vbNewLine & strbody8
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "JOB CHANGE" & Space(1) & Range("B5")
.Body = strbody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
MsgBox "Request Sent", vbApplicationModal, "Complete"
End Sub