Hi All,
I'm converting Excel sheet to PDF and send via email (outlook). I have made this to email, but I'm unable to work out how to add my signature and also my "Body" has comma and don't know how to line break it.
Can someone help me with this VBA code? or what am I doing wrong?
I'm converting Excel sheet to PDF and send via email (outlook). I have made this to email, but I'm unable to work out how to add my signature and also my "Body" has comma and don't know how to line break it.
Can someone help me with this VBA code? or what am I doing wrong?
VBA Code:
Sub SendExcelFilesAsPDF()
Dim OutlookApp As Outlook.Application
Dim emItem As Object
Dim Recipient As String, Subject As String
Dim Message As String, Fname As String
Dim x As Date
x = Format(Now() + 1, "MMMM dd, yyyy")
' Message details
Recipient = "kitsas@erectsafe.com.au"
Subject = Range("K13") & " " & x
'Message = Range("F19")
Message = Range("K14").Value
Fname = Range("F19") & ".pdf"
' Create the PDF attachment
ActiveSheet.ExportAsFixedFormat Type:=x1TypePDF, Filename:=Fname
' Create Outlook object
Set OutlookApp = New Outlook.Application
' Create email Item, display or send it
Set emItem = OutlookApp.CreateItem(olMailItem)
With emItem
.To = Recipient
.Subject = Subject
.HTMLBody = Message & .HTMLBody
.Attachments.Add Fname
.Display
End With
Set OutlookApp = Nothing
End Sub