Hi Guys,
I have a cell [K14] which has "Hi Peter Homes, As attached is the quote you have requested". When I VBA to email body, it doesn't line break, want it to look like below:
I have a cell [K14] which has "Hi Peter Homes, As attached is the quote you have requested". When I VBA to email body, it doesn't line break, want it to look like below:
I have code:Hi Peter Homes,
As attached is the quote you have requested
VBA Code:
Private Sub CommandButton1_Click()
'Sub SendExcelFilesAsPDFtoEmail()
Dim OutApp As Object
Dim OutMail As Object
Dim Strbody As String, Fname As String
Dim x As Date
x = Format(Now() + 1, "MMMM dd, yyyy")
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Fname = "EQ" & Range("F19") & ".pdf"
Strbody = Range("K14")
On Error Resume Next
' Create the PDF attachment
ActiveSheet.ExportAsFixedFormat Type:=x1TypePDF, Filename:=Fname
With OutMail
.Display
.To = Range("K11").Value
.Subject = Range("K13") & " " & x
.HTMLBody =.HTMLBody & "<br/><br/>" & Replace(Strbody, vbCr, "<br/>")
.Attachments.Add Fname
.Importance = 2 'Or olImprotanceHigh Or olImprotanceLow
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Set OutLookMess = Nothing
Set OutLookNSpace = Nothing
End Sub
Last edited: