email HTML doc from within access



I have been using an access2k db for sometime to email text files to contacts
held in the database. I am trying to use the same approach to send an HTML
file. All that arrives at the other end is the HTML code. I am obviously
missing something! Here is the code I'm using (which somebody on here pointed
me to many months ago). Please help - its driving me mad

Dim db As DAO.Database
Dim MailList As DAO.Recordset
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim Subjectline As String
Dim BodyFile As String
Dim fso As FileSystemObject
Dim MyBody As TextStream
Dim MyBodyText As String

Set fso = New FileSystemObject

Set MyBody = fso.OpenTextFile(BodyFile, ForReading, False, TristateUseDefault)

MyBodyText = MyBody.ReadAll

Set MyOutlook = New Outlook.Application

Set db = CurrentDb()

Set MailList = db.OpenRecordset("MyEmailAddresses")

Do Until MailList.EOF
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = MailList("email")
MyMail.Subject = Subjectline$
MyMail.BodyFormat = olFormatHTML
MyMail.Body = MyBodyText
MyMail.BodyFormat = olFormatHTML

The only changes I have made are the BodyFormat lines (I've put it in twice)

Many thanks in anticipation.


THank you Alex - It worked a treat - I thought it was something silly - Thank
you so much

Roger Everest

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