Sending out MIME Mails from Excel using Outlook

  • Thread starter Thread starter Michael Herzog
  • Start date Start date
M

Michael Herzog

I currently use an Excel sheet prepared by a co-worker that calculates some
data and makes some kind of newsletter out of it, which is send with the
Outlook object.

The part of the script looks like this:

Set oOutlookApp = GetObject(, "Outlook.Application")
Set oItem = oOutlookApp.CreateItem(oIMailItem)
With oItem
.To = customeremail
.Subject = [...]
.Body = [...]
.Attachments.Add [...]
.Send
End With

The problem is, that Outlook (2000) sends it out as a pretty unspectacular
RTF message. Since there is a chapter in the company style guide for
newsletter, I wanted to convert it to a nice MIME newsletter using .HTMLBody
instead of .Body. Second problem is, I don't know very much about VBA or
MIME mails.

I think I can't just prepare the newsletter like a webpage with Dreamwaver
and Photoshop, convert it to MIME using "Save as single page" in IE and
copy/paste the contents of the MHT-file to the Visual Basic window. Is there
an elegant way to make this work? Like some tools that mask characters I
can't use in Visual Basic or something?
 
Accessing Item.Body in Outlook 2000 automatically makes the message RTF.

See http://www.outlookcode.com/d/formatmsg.htm for information about
creating HTML formatted messages in Outlook.

BTW, that code you have will fail unless Outlook is already running. Using
CreateObject would be better since it will create an Outlook session if none
exists and use the existing session if there is one.
 
Ken Slovak - said:
See http://www.outlookcode.com/d/formatmsg.htm for information about
creating HTML formatted messages in Outlook.

Hmm... is there no way to mask the source code from the MHT-file and paste
it in the VBA window, or make the script read it from a file?
Okay - maybe that would be a little too easy... :)
BTW, that code you have will fail unless Outlook is already running. Using
CreateObject would be better since it will create an Outlook session if none
exists and use the existing session if there is one.

I already noticed this quirk - thanks for your advice.
 
The only ways I know of to HTML format messages is what is shown on the
outlookcode Web site.
 
Back
Top