PDA

View Full Version : Exporting Access form to Outlook message text formatting



brownpride
08-30-2016, 07:12 PM
I have been successful in exporting the active record in PDF format to Outlook for e-mail using VBA. I have added text to the email. However when the message text exports to Outlook the 1st line is blank and the text starts on the 2nd line. For example...

Message Text:
"Unwanted Empty Line"
"Dear...."
""
"Please..."

How can I have the "Dear..." start on the 1st line of the e-mail (instead of the 2nd line) without manually formatting the e-mail?

Code is below.

Sub Send_Click()
Dim strDocName As String
Dim strWhere As String
strDocName = "frmInvoice"
strWhere = "[ID]=" & Me.ID
DoCmd.ApplyFilter cPreview, strWhere
Dim mailto As String
Dim emailmsg As String
mailto = [Invoice Contact - E-mail]
emailmsg = "Dear " & [Invoice Contact - First Name] & " " & [Invoice Contact - Last Name] & "," & vbCrLf & vbLf & _
"Please see attached invoice from the previous month. If you have any questions, please respond to this e-mail." & vbCrLf & vbLf & _
"Thank You," & vbCrLf & _
"Joe"
mailsub = ""
DoCmd.SendObject acSendForm, "frmInvoice", acFormatPDF, mailto, , , mailsub, emailmsg, True
End Sub