CSS Styling Outlook VBA HTML Email

I have been given the task of styling an HTML email generated by Office
Outlook 2003 VBA Language

Stylewise, I would like to get some perspective on what is possible or not
possible with this.

I have also heard that there are changings coming in Outlook 2007 which
will render HTML email using the MS Word engine, dropping the use of IE
for this purpose.



The examples about OutLook VBA on the Microsoft Web site are very simplistic
'Set the HTMLBody of the item.
    Item.HTMLBody = "<HTML><H2>My HTML page.</H2><BODY>My
    'Item displays HTML message.

So my question would be can you use use css formating?
If so where do you state it or import it?

Could the a Item.HTMLBody = be modified to include:

<title>Untitled Document</title>
<style type="text/css">
.style3 {font-size: 12px}

Or is the formatting done in an older way whereby the font and background
colors are stuffed in side the table cells?
Who is Participating?
Mark_FreeSoftwareConnect With a Mentor Commented:

this is also an example how you can include css in your page:

<HTML><H2>My HTML page.</H2><BODY style="color:#FF0000; font-weight:bold;">My body.</BODY></HTML>
David LeeConnect With a Mentor Commented:
Yes, you can use CSS formating.  The Style declarations go in the usual spot, in the HEAD portion of the HTML document.  The style declarations really need to be in the HTML document as opposed to usings linked CSS style sheets.  The reason for that is if a user happens to view the message when not connected to the internet, then a linked style sheet wouldn't work.  

I've found it to be much easier to create the HTML document in a web page editor, e.g. FrontPage or DreamWeaver, and read the entire page in rather than put all the HTML code in the script.
LT1415Author Commented:
Thanks. Can I amend my question to ask about how would one embed an image, like a logo?
If you are using VBA inside of an Access form I'm not clear how this is accomplished.
Where does the image reside?

Also in reading some posts on the internet it looks like Outlook 2007 is a nightmare for css users, so it's back to tables and font tags
David LeeConnect With a Mentor Commented:
Adding an image to an HTML message is no different than adding an image to any HTML document.  Simply insert an IMG tag.  To embed the image instead of linking to it follow the steps outlined in this article: http://www.outlookcode.com/d/code/htmlimg.htm
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.