Reputation: 211
How is it going,
I am trying to make a super simple automated email script that sends quick update emails on project statuses. Trying not to loop to death, I put all update comments in one cell with a newline char(10) for each point. Example:
When I try to translate that into VBA, I lose the Char(10):
Below is the section I am struggling with
strUpdateNotes = Range("D" & i).Text
olNewMail.HTMLBody = "Happy Friday!" & _
"<br />" & _
"<br />" & _
"Weekly Project Update!" & _
"<br />" & _
"<br />" & _
"Current Comments on the project:" & _
"<br />" & _
strUpdateNotes & _
"<br />" & _
"<br />" & _
"Let me know if you have any questions. Have a fantastic weekend!"
Is there a way to keep the newline char(10) from the cell to help with readability in the email?
Thanks!
Upvotes: 0
Views: 124
Reputation: 11755
Assuming it's actually JUST a Chr(10)
then
strUpdateNotes = Replace(Range("D" & i).Text, vbLf, "<br />")
other possibilities:
strUpdateNotes = Replace(Range("D" & i).Text, vbCr, "<br />")
or
strUpdateNotes = Replace(Range("D" & i).Text, vbCrLf, "<br />")
Upvotes: 1