Multiple lines in email from Access

Posted on 2004-11-17
Medium Priority
Last Modified: 2012-05-05
I am trying to send an email from Access through Outlook.
It all works, but I can't get it to send with multiple lines.
I have tried everything I can think of.  vbcrlf, chr$(13), vbcr+vblf, "/n"
None of it works, it just ignores those characters, and puts it all on one line.

Dim sBuffer as String
Set obj = mobjOut.CreateItem(olMailItem)
sBuffer = "Line 1" +vbcrlf + "Line 2"
obj.HTMLBody = sBuffer
obj.To = sEmail
obj.Subject = "Example"

Any ideas??
Question by:davidkroiter

Expert Comment

ID: 12612489
With HTML, you should tags to format text; here a <p> should help:

sBuffer = "Line 1" +"<p>" + "Line 2"

Accepted Solution

szacks earned 800 total points
ID: 12612675
If you are using HTMLBody then you will need HTML tags.
A new line is <br> a new paragraph is <p> etc..

Instead of using HTMLBody you might want to consider using the Text body, though I don't recall the exact syntax for it.

Expert Comment

ID: 12612993
Just use the basic Body property instead, unless you want a formatted email, in which case as others have pointed out, you will need to provide appropriate tags, e.g.

sBuffer = "<html><body><p>Hello world</p><p>Yours faithfully<br><i>Me.</i></p></body></html>"

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exchange database can often fail to mount thereby halting the work of all users connected to it. Finding out why database isn’t mounting is crucial and getting the server back online. Stellar Phoenix Mailbox Exchange Recovery is a champion product t…
If you try to migrate from Elastix to Issabel, you will face a lot of issues. These problems are inevitable but fortunately, you can fix them. In the guide below, I will explain how I performed the migration while keeping all data and successfully t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question