When my email generates it doesn't have the line breaks despite using the "& vbCrLf &"
code. I've tried using the <br>
and <p>
but I get compile errors every time.
Can someone please take a look at my code and help a brother out?
Dim strbody As String
Set xOutlookObj = CreateObject("Outlook.Application")
Set xEmailObj = xOutlookObj.CreateItem(0)
With xEmailObj
.Display
.to = xMemberName5
.CC = ""
.Subject = "Annual Review " xMemberName " " "Cust " xMemberName3
strbody = "<p style='font-family:calibri;font-size:11pt;color:rgb(31,78,121)'>" xMemberName7 "," _
& vbCrLf & vbCrLf & "Our records indicate that " xMemberName " is due for an annual pricing review. We are seeking an overall impact of " xMemberName6 "% increase to the rates. Updated Tariff page is attached." _
& vbCrLf & "If there are any pricing issues which need to be addressed, please get back to me no later than " & CDate(Date 7) & "." _
& vbCrLf & vbCrLf & "Otherwise, the attached new pricing will be effective " xMemberName4 ". I encourage you to visit with your customer and deliver the new pricing ASAP." & .HTMLBody & "</body>"
.HTMLBody = strbody
CodePudding user response:
Just include the <br>
directly in your string as you did with <p>
already
strbody = "<p style='font-family:calibri;font-size:11pt;color:rgb(31,78,121)'>" & xMemberName7 & "," _
& "<br><br>Our records indicate that " & xMemberName & " is due for an annual pricing review. We are seeking an overall impact of " & xMemberName6 & "% increase to the rates. Updated Tariff page is attached." _
& "<br>If there are any pricing issues which need to be addressed, please get back to me no later than " & CDate(Date 7) & "." _
& "<br><br>Otherwise, the attached new pricing will be effective " & xMemberName4 & ". I encourage you to visit with your customer and deliver the new pricing ASAP." & .HTMLBody & "</body>"
And I recommend to use &
instead of
to concatenate your variables with strings.