Hot to get line break in macro generated email

S

Shanx

Sorry if this has been asked before?
I haven't been able to find a thread that discusses this topic.

I have a macro which auto-generates emails using the following code:
______
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = recipient
.cc = manager
.BCC = ""
.Subject = "Reminder of Training/Certification Renewal"
.HTMLbody = EmailText
.Send '.display
End With
Set OutMail = Nothing
Set OutApp = Nothing
Application.ScreenUpdating = True
______

To create my email body (.HTMLbody = EmailText), i have a bunch of looped
code which generated some canned email message based on certain conditions in
my spreadsheet. I basically do so like this:
______
EmailText = EmailText & Chr(13) & "Your training/certification:"
....
....
EmailText = EmailText & Chr(13) & "It is your responsibility to arrange for
any renewal/recertification required. Please speak with your line manager for
approval of any training or re-training initiatives."
______

I am using Chr(13) {or alternatively Chr(10)} to try and create linebreaks
in my email. However, neither of these functions will generate an email with
line breaks (or carriage returns). I just end up with a continuous set of
text with a space in place of my line breaks.

All of my other code is working flawlessly generating my email, i just need
it to have proper line breaks.
I would really appreciate if someone could help me out with this!

Thanks in advance,
David

p.s. if you are able to help me have formatting in the email (like bold)
that would also be a bonus, but not required.
 
J

Jim Thomlinson

Have you tried vbCrLf in place of chr(13) chr(10)

vb carriage return line feed
 
S

Shanx

I had also tried vrCrLf, but just forgot to mention it as it was the original
thing I had tried.

I have figured out now that the text in am inputing into .HTMLbody is being
treated as HTML code (duh!!!)
So I have been able to solve my problem by using <p></p> & <br/> for line
breaks (paragraphs) and <b> </b> for bold

Thank you for the quick response :)
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top