Multiple lines in email from Access

Posted on 2004-11-17
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
    LVL 7

    Expert Comment

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

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

    Accepted Solution

    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

    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

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
    Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now