A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

No image when stationery applied via code



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 21st 07, 01:21 PM posted to microsoft.public.outlook,microsoft.public.outlook.general,microsoft.public.outlook.program_vba
John
external usenet poster
 
Posts: 135
Default No image when stationery applied via code

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


  #2  
Old January 23rd 08, 03:17 AM posted to microsoft.public.outlook,microsoft.public.outlook.general,microsoft.public.outlook.program_vba
B Clumpner
external usenet poster
 
Posts: 2
Default No image when stationery applied via code

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



  #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



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
No image when stationery applied via code John Outlook - General Queries 2 January 23rd 08 05:56 AM
Stationery background image problem John Outlook - General Queries 3 November 17th 07 09:41 PM
Stationery background image problem John Outlook - Installation 3 November 17th 07 09:41 PM
Background image in stationery John Outlook - General Queries 0 November 17th 07 04:29 AM
No email stationery when through code John Outlook - General Queries 2 September 21st 06 12:02 PM


All times are GMT +1. The time now is 09:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.