Using word document in Mailitem

TonyBunney

New member
Joined
Dec 10, 2009
Messages
2
Programming Experience
1-3
First of all I apologies if my question has been addressed in these forums already but I have now been searching all morning and I have now started to pull my hair out.
I have developed an in-house system to send emails to my clients, partially because I want full control over what I end to who and also to ensure that the number of emails I send does not exceed email limits imposed by my ISP.
It has been working OK for the past 6 months but now I have a Newsletter from one of my affiliate schemes that I want to send to over 2,000 of my clients and I have hit a little problem with formatting.
In brief, my in-house system identifies both an email address and a word document to send and then uses the following code (simplified) to build the email body.

Me.WordMainDoc = Me.WordApp.Documents.Open(FullDocPath)
Dim mailMail As Outlook.MailItem
mailMail = Me.OutlookApp.CreateItem(Outlook.OlItemType.olMailItem)
mailMail.Subject = "Some Email Campaign Name"
mailMail.To = mytestemail@mysite.com

Dim rEmailBody As String
rEmailBody = Me.WordMainDoc.Content.Text
mailMail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML
mailMail.Body = rEmailBody
Try
mailMail.Send()
Catch ex As Exception
' Display exception Message
End Try

The majority of the documents that I send as email messages work fine but when I tried to use a document which has images and links, the above did not work as all of the links and images disappeared.
I played around with the settings for mailMail.BodyFormat and also different properties of the opened word document (Me.WordMainDoc.Content) I even tried mailMail.Body = Me.WordMainDoc.Content.Text but to no avail.
I now find myself going round in circles and I am sure that the code required for my requirement is simple.
So to summarise, all I am trying to do is use the content of a word document as the body of an email, keeping both the images and the hyperlinks.

Many Thanks
Tony
 
Back
Top