Merging Word doc to Mail

  • Thread starter Thread starter mikelee101
  • Start date Start date
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
 
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.
 
Back
Top