Hey guys,
I have a VBA that creates an email, attaches a PDF, adds a body message, and displays the email. This part works great but the code takes my email signature off and I am not sure how to keep or add the signature back. Could someone please help me. Any help is greatly appreciated. Below is the code that I'm using. Thank you.
saveLocation = "S:\"
attachmentName = "AI_2023_04.pdf"
Set EmailPDF = Worksheets("AI").Range("b1", Range("i11").End(xlDown).End(xlToRight))
Set EmailPDF = EmailPDF.Resize(EmailPDF.Rows.Count + 1)
'Email body
strbody = "Hello" & vbNewLine & vbNewLine & _
"Please see the attached commission statement for April. This month you will receive the direct deposit on 05/12/23. " & vbNewLine & _
" " & vbNewLine & _
"If you have any questions, please let me know." & vbNewLine & _
" " & vbNewLine & _
"Regards,"
EmailPDF.ExportAsFixedFormat Type:=xlTypePDF, Filename:=attachmentName
Set EmailApp = CreateObject("Outlook.application")
Set EmailItem = EmailApp.CreateItem(0)
With EmailItem
.To = ""
.Subject = "Commission Statement"
.body = strbody
.Attachments.Add attachmentName
.Display
End With
Set EmailItem = Nothing
Set EmailApp = Nothing
I have a VBA that creates an email, attaches a PDF, adds a body message, and displays the email. This part works great but the code takes my email signature off and I am not sure how to keep or add the signature back. Could someone please help me. Any help is greatly appreciated. Below is the code that I'm using. Thank you.
saveLocation = "S:\"
attachmentName = "AI_2023_04.pdf"
Set EmailPDF = Worksheets("AI").Range("b1", Range("i11").End(xlDown).End(xlToRight))
Set EmailPDF = EmailPDF.Resize(EmailPDF.Rows.Count + 1)
'Email body
strbody = "Hello" & vbNewLine & vbNewLine & _
"Please see the attached commission statement for April. This month you will receive the direct deposit on 05/12/23. " & vbNewLine & _
" " & vbNewLine & _
"If you have any questions, please let me know." & vbNewLine & _
" " & vbNewLine & _
"Regards,"
EmailPDF.ExportAsFixedFormat Type:=xlTypePDF, Filename:=attachmentName
Set EmailApp = CreateObject("Outlook.application")
Set EmailItem = EmailApp.CreateItem(0)
With EmailItem
.To = ""
.Subject = "Commission Statement"
.body = strbody
.Attachments.Add attachmentName
.Display
End With
Set EmailItem = Nothing
Set EmailApp = Nothing