View Single Post
  #3  
Old January 23rd 08, 05:56 AM posted to microsoft.public.outlook,microsoft.public.outlook.general,microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default No image when stationery applied via code

Except that current versions of Outlook and many other mail programs don't display externally linked images. See http://www.outlookcode.com/d/code/htmlimg.htm for a code technique for inserting embedded images in HTML.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"B Clumpner" B wrote in message ...
John,

Your html code is linking to the graphic on your system. Since outside folks
don't have access to your system, it comes up blank. If you can park the
graphic on a web-site somewhere and reference that URL in your code, your
image will link from every message that's sent out.

Bruce

"John" wrote:

Hi

I am applying stationary to my outgoing email message when sending mail via
code. The exact code is given at the end. The problem is that the image doe
snot appear in the stationery at the other end. What is the problem and how
can I get the image to accompany the mail as part of the stationary?

I am running the code from within MS Access.

Many Thanks

Regards


Code
====

Set OutlookApp = New Outlook.Application
Set EM = OutlookApp.CreateItem(olMailItem)

With EM
.To = "
.Subject = "Any Subject"
.HTMLBody = HTMLTextAndSignature("This is body text")
.Display (False)
End With


Function HTMLTextAndSignature(EmailBody) As String
Dim fso
Dim Ts
Dim Signature As String

Set fso = CreateObject("Scripting.FileSystemObject")
Set Ts = fso.OpenTextFile("F:\Email Stationery\Email_Template.htm", 1)
Signature = Ts.ReadAll

' [Body] is a tag in html file as a placeholder to actual body text ,
[Body] is replaced with actual body text here
If IsNull(EmailBody) Then
Signature = Replace(Signature, "[Body]", " ")
Else
Signature = Replace(Signature, "[Body]", EmailBody)
End If

HTMLTextAndSignature = Signature
End Function


Content of Email_Template.htm, the image that does not display is F:/Email
Stationery/investor+small.jpg
================================================== ====================

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
HTML
HEAD
META http-equiv=Content-Type content="text/html; charset=windows-1252"
style type="text/css"
!--
body {
background-attachment: fixed;
background-color: "#FFFFFF";
background-repeat: no-repeat;
font-family: "Century Gothic";
font-size: 10pt;
font-weight: normal;
}
--
/style
/HEAD
BODY BACKGROUND="file:///F|/Email Stationery/E.jpg" bgcolor="#FFFFFF"
table border=0 summary=""
tr
td width="464"
DIV align=left
My NameBR
/DIV
/td
td width="70" valign="bottom"br
img src="file:///F|/Email Stationery/investor+small.jpg" width="89"
height="59"
/td
/tr
/table
/body
/HTML



Ads