Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building Outlook Mail Body

Status
Not open for further replies.

MikeC14081972

Programmer
May 31, 2006
137
GB
Probably missing the obvious here, but here goes.

I need to build a routine that will build an email in Outlook from Access 2003 based on numerous recordsets.

In Lotus Notes it easy

Code:
' After setting up the mail
with objNotesRTF
    .AddNewLine 1
    .AppendText "Line 1"
    .AddNewLIne 1
    .AppendText "Line 2"
    ......etc etc
end with

Is there a way of doing the above in Outlook, i.e. append data to the body of an email one line at a time.

I can only find reference to building a string containing all the data and relevant HTML tags before applying to the mails body as a bulk drop.

Due to the length and required formatting in the mail this isn't really an option, so I would like to something like

Code:
    .HTMLBody = "<html><body><b>Start of Message</b>"
    .HTMLBody = "<br>"
    .HTMLBody = "Second Line of email"
    .HTMLBody = "<br>"
    .HTMLBody ="<b><u>New Heading</u></b>"
    .HTML = "</body></html>

If I was to use the above code the email body is empty as it will overwrite the body with each instance of .HTML = "blah blah blah"

If the above isn't possible I know I can us RichText instead so my question would then be how do I format each line of text as required using the below to append to the body

Code:
    .body = "Start of Message"
    .body = .body & vbcrlf
    .body = .body & "Second Line of Mail"
    .body = .body & vbcrlf
    .body = .body & "New Heading"

I hope that all makes sense, I know what I'm trying to say :lol: I'll worry about the numerous annoying security messages later.

Or should I get our mail client switched to Notes as it's so much simplier.

Thanks in Advance
 
Not to worry guys.

Have worked out a solution, like I thought, I was missing the obvious.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top