Merging Word doc to Mail

M

mikelee101

Hello,
I'm trying to do a Mail Merge in Word 2003 to email (Outlook 2003)
with a dynamic subject line. Turns out that has to be done through
VBA. I have that done, but the message loses quite a bit of the
formatting, regardless of what I specify as the .BodyFormat property.
Not being all that familiar with VBA for Outlook, I figured I'd see if
anyone had any suggestions. Here's the snippet of code that generates
the message:

Set olMsg = olApp.CreateItem(olMailItem)

With olMsg
.To = MgDoc.MailMerge.DataSource.DataFields(2)
.Subject = "Important Information Regarding " &
MgDoc.MailMerge.DataSource.DataFields(1)
.BodyFormat = olFormatRichText
.Body = MgDoc.Content
End With

olMsg.Send
Set olMsg = Nothing

MgDoc is the word document. The closest I get is by setting
the .BodyFormat property to olFormatRichText. At that point, about
the only thing that I lose is font size and font color.
Unfortunately, those are two relatively important pieces of
formatting.

If anyone has any suggestions on how I can bring the contents of the
doc over complete with font color and size, I'd really appreciate it.

Thanks,
Mike Lee
Coppell, TX
 
K

Ken Slovak - [MVP - Outlook]

Probably the best way is to convert the Doc into HTML format in code and
then to use HTML in the Outlook item. You might have to work on HTMLBody to
get things exactly as you want but that would be easier than trying to
manipulate RTF format text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top