VBA is changing my email HTML format and putting extra styles in it.

N

news.xs4all.nl

I'm using the following code to produce and send an email from ms-access:

================================================================
Dim stSql As String
Dim iIndex As Integer
Dim strHTML As String
Dim strHeader As String

Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem

Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)

strHeader = "<HEAD><title>Status</title><STYLE>"
strHeader = strHeader & gstrStyle
strHeader = strHeader & "</STYLE>"
strHeader = strHeader & "</head>"


strHTML = statusTabel()
olMail.To = getEmailAddress()
olMail.Subject = "Status"
olMail.HTMLBody = "<HTML>" & strHeader & "<BODY>"& strHTML &
"</BODY></HTML>"
olMail.SentOnBehalfOfName = "Info"
olMail.ReadReceiptRequested = True

olMail.BodyFormat = olFormatHTML
olMail.Display
==============================================================

But when i look into the source of de html-email there is a LOT of extra
style code introduced and even supersedes my onwn style?

What am I doing wrong.

Ernst
 
G

Guest

Ernst

what are the values of:

gstrStyle
statusTabel()
getEmailAddress()

the code without these values create the email ok.

Paul
 
E

Ernst

Hi Paul

To make it easier, this is the complete text that is put in the HTML body of
the email:


<HTML><HEAD><title>Status</title><STYLE>.flexs1_tabel{font: 9px Verdana,

sans-serif;line-height: 10px;background-color: #CC99FF;}

..flexs1_tabelheader{font: bold 10px Verdana, sans-serif;line-height:

10px;background-color: #CCCCCC;} body{font: 9px Arial,

sans-serif;line-height: 10px;}</STYLE></head><BODY>Beste Peter,<TABLE

BORDER="1" CELLPADING="0" CELLSPACING="0" WIDTH="100%">



<TR><TH class=flexs1_tabelheader colspan="5">Customer Status:
offer</TH></TR><TR><TH

class=flexs1_tabel>Document</TH



<TH class=flexs1_tabel>Ontvangen?</TH

<TH class=flexs1_tabel>Datum</TH

<TH class=flexs1_tabel>Akkoord?</TH

<TH class=flexs1_tabel>Notitie</TH

</TR><TR><TD class=flexs1_tabel>getekende offerte</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>&nbsp;</TD

</TR><TR><TD class=flexs1_tabel>kopie eigendomsbewijs</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>&nbsp;</TD

</TR><TR><TD class=flexs1_tabel>kopie paspoort aanvrager</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>&nbsp;</TD

</TR><TR><TD class=flexs1_tabel>kopie paspoort partner</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>&nbsp;</TD

</TR><TR><TD class=flexs1_tabel>loonstrook aanvrager</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>15-08/09-09</TD

</TR><TR><TD class=flexs1_tabel>loonstrook partner</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>15-08/12-09</TD

</TR><TR><TD class=flexs1_tabel>medisch acceptatie</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>Delta Loyd polis.</TD

</TR><TR><TD class=flexs1_tabel>taxatierapport (origineel)</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>executie waarde ? 180.000</TD

</TR><TR><TD class=flexs1_tabel>werkgeversverklaring aanvrager

(origineel)</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>&nbsp;</TD

</TR><TR><TD class=flexs1_tabel>werkgeversverklaring partner

(origineel)</TD

<TD class=flexs1_tabel>Ja</TD

<TD class=flexs1_tabel>28-10-2005</TD

<TD class=flexs1_tabel>&nbsp;</TD

<TD class=flexs1_tabel>&nbsp;</TD

</TR></TABLE>

</BODY></HTML>





If needed, I can send the body of the email after it pops up in Outlook.


Gr Ernst
 

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