View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Hot to get line break in macro generated email

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

vb carriage return line feed
--
HTH...

Jim Thomlinson


"Shanx" wrote:

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.