Hi Everyone
With help from other members I currently have the following Code which sends an Email with 2 Reports as attachments.
The Code:-
Code:
Private Sub cmdPDFEMail_Click()
On Error GoTo cmdPDFEMail_Click_Error
Dim strSQL As String
Dim objOutlookAttach As Object
Dim objApp As Object
Dim objMailItem As Object
Dim strAttachmentPDF As String
Dim strAttachmentREP As String
Dim strMailItem As String
Dim strWhere As String
Dim strToWhom As String
Dim strMsg As String
Dim strSubject As String
'
' ======================= Set up all your variables =========================
strWhere = "[CustomerID]=" & Me.CustomerID
strToWhom = Me.Email
strSubject = "PDF Guide"
strMsg = "Find attached details of CARI Setup Process"
'Set your PDF path here
strAttachmentPDF = "C:\PDF\CreateCARIAccount.pdf"
'Set the report path here
strAttachmentREP = Application.CurrentProject.Path & "\rptCariProviderLetter_" & Me.CustomerID & ".pdf"
'Application.FollowHyperlink strAttachmentPDF - use to check that the file exists
'Exit Sub
' ========================= 'create the report ==============================
DoCmd.OpenReport "rptCariProviderLetter", acViewPreview, , strWhere, acHidden
DoCmd.OutputTo acOutputReport, "rptCariProviderLetter", acFormatPDF, strAttachmentREP
DoCmd.Close acReport, "rptCariProviderLetter", acSaveNo
'
' ========================= Now do some outlook stuff ! ===================
Set objApp = CreateObject("outlook.application")
Set objMailItem = objApp.CreateItem(0)
objMailItem.Subject = strSubject
objMailItem.To = strToWhom
objMailItem.Body = strMsg
'add the pdf
objMailItem.Attachments.Add strAttachmentREP
'now lets attach the report
objMailItem.Attachments.Add (strAttachmentPDF)
objMailItem.Display 'change to .Send if you want to just send it.
On Error GoTo 0
Exit Sub
cmdPDFEMail_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdPDFEMail_Click, line " & Erl & "."
End Sub
I now need to add the following into the Body of the Email as Text Paragraphs:-
MyMsg = MyMsg
MyMsg = "Onboarding Announcement:" & vbCrLf
MyMsg = MyMsg & "As a part of the Onboarding process, please ensure that the below two-step process" & vbCrLf
MyMsg = MyMsg & "is completed for your CARI account. " & vbCrLf
MyMsg = MyMsg & "Step 1: Create a CARI Account." & vbCrLf & vbCrLf
MyMsg = MyMsg & "(FYI: Use the link in the attached letter to create your account and not the below link in this email" & vbCrLf
Where would I insert these lines?
Any help appreciated