![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]() In VBA (Office 2003), I am trying to create a new email and set the body text to a saved HTML document but my graphic is not being displayed. I have used the following combinations of code (each try is commented out) but without success. If I use .mht and open the email in the Outbox the graphic appears but when I save and reopen it, it appears as a placeholder only, not the graphic. I would appreciate any ideas. Thanks, Graham. Dim fso As FileSystemObject Dim ts As TextStream Dim strText As String Set fso = CreateObject("Scripting.FileSystemObject") 'Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\RepplyF.htm", ForReading) Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\Repply.htm", ForReading) 'Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\Repply.mht", ForReading) 'Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\Repply.mht.doc", ForReading) 'Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\Repply.htm.doc", ForReading) strText = ts.ReadAll mai1.HTMLBody = strText -- grahamproctor ------------------------------------------------------------------------ grahamproctor's Profile: http://www.officehelp.in/member.php?userid=6171 View this thread: http://www.officehelp.in/showthread.php?t=1325714 Posted from - http://www.officehelp.in |
#2
|
|||
|
|||
![]()
See http://www.outlookcode.com/d/code/htmlimg.htm
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "grahamproctor" wrote in message ... In VBA (Office 2003), I am trying to create a new email and set the body text to a saved HTML document but my graphic is not being displayed. I have used the following combinations of code (each try is commented out) but without success. If I use .mht and open the email in the Outbox the graphic appears but when I save and reopen it, it appears as a placeholder only, not the graphic. I would appreciate any ideas. Thanks, Graham. Dim fso As FileSystemObject Dim ts As TextStream Dim strText As String Set fso = CreateObject("Scripting.FileSystemObject") 'Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\RepplyF.htm", ForReading) Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\Repply.htm", ForReading) 'Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\Repply.mht", ForReading) 'Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\Repply.mht.doc", ForReading) 'Set ts = fso.OpenTextFile("g:\Medics Away\Mailing Documents\Repply.htm.doc", ForReading) strText = ts.ReadAll mai1.HTMLBody = strText -- grahamproctor ------------------------------------------------------------------------ grahamproctor's Profile: http://www.officehelp.in/member.php?userid=6171 View this thread: http://www.officehelp.in/showthread.php?t=1325714 Posted from - http://www.officehelp.in |
#3
|
|||
|
|||
![]() Many, many thanks Dmitri and all the great advice you make available. I have only one problem now: how do I get the HTML text into the Body following the graphic? Am I thick or is this stuff DIFFICULT ???? Graham -- grahamproctor ------------------------------------------------------------------------ grahamproctor's Profile: http://www.officehelp.in/member.php?userid=6171 View this thread: http://www.officehelp.in/showthread.php?t=1325714 Posted from - http://www.officehelp.in |
#4
|
|||
|
|||
![]()
I am not sure I understand - what do you mean by "Body following the
graphic"? You do not split the HTML body into multiple part (before and after), you set the whole thing. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "grahamproctor" wrote in message ... Many, many thanks Dmitri and all the great advice you make available. I have only one problem now: how do I get the HTML text into the Body following the graphic? Am I thick or is this stuff DIFFICULT ???? Graham -- grahamproctor ------------------------------------------------------------------------ grahamproctor's Profile: http://www.officehelp.in/member.php?userid=6171 View this thread: http://www.officehelp.in/showthread.php?t=1325714 Posted from - http://www.officehelp.in |
#5
|
|||
|
|||
![]() Thanks again, Dmitri. What I am trying to achieve is having a graphic at the top of the email body, immediately followed by text which has been customised with different fields from a database, dependent on the recipient and other parameters. The uncustomised text is currently stored in a .htm and I have successfully customised this HTML in code, before putting it into the HTML.Body. So conceptually, I am trying to append that HTML text to the graphic already in the body of the email. I tried before to have the graphic in the .htm but that was unsuccessful because the graphic just turned into a placeholder when it reached Outlook. Funnily enough, the graphic did appear in the untitled email when it was displayed from code but when I sent or saved it, the graphic disappeared when it was in the Outbox. I tried your other trick to make the graphic a watermark/background in the body and that worked fine, except for sizing issues but that still left me with the problem of how to append the HTML text to the HTML.Body without replacing the graphic which was already successfully placed there. I suppose I could try to combine the graphic and text into a .jpg in code and then use your trick but how I would do that I have no idea. Puzzling? Not for you!!! All the best, Graham. -- grahamproctor ------------------------------------------------------------------------ grahamproctor's Profile: http://www.officehelp.in/member.php?userid=6171 View this thread: http://www.officehelp.in/showthread.php?t=1325714 Posted from - http://www.officehelp.in |
#6
|
|||
|
|||
![]()
So you really need to merge two HTML strings into one. You can either create
an instance of the IHTMLDocument2 object, load your data, then modify the HTML (insert other HTML strings, etc) using DOM. Or, if you simply need to insert an HTML substring at the very beginning 1. Find the position of the "body" substring 2. Find the position of the next "" character (this is needed to skip over the body attributes) 3. Insert new HTML at that position + 1. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "grahamproctor" wrote in message ... Thanks again, Dmitri. What I am trying to achieve is having a graphic at the top of the email body, immediately followed by text which has been customised with different fields from a database, dependent on the recipient and other parameters. The uncustomised text is currently stored in a .htm and I have successfully customised this HTML in code, before putting it into the HTML.Body. So conceptually, I am trying to append that HTML text to the graphic already in the body of the email. I tried before to have the graphic in the .htm but that was unsuccessful because the graphic just turned into a placeholder when it reached Outlook. Funnily enough, the graphic did appear in the untitled email when it was displayed from code but when I sent or saved it, the graphic disappeared when it was in the Outbox. I tried your other trick to make the graphic a watermark/background in the body and that worked fine, except for sizing issues but that still left me with the problem of how to append the HTML text to the HTML.Body without replacing the graphic which was already successfully placed there. I suppose I could try to combine the graphic and text into a .jpg in code and then use your trick but how I would do that I have no idea. Puzzling? Not for you!!! All the best, Graham. -- grahamproctor ------------------------------------------------------------------------ grahamproctor's Profile: http://www.officehelp.in/member.php?userid=6171 View this thread: http://www.officehelp.in/showthread.php?t=1325714 Posted from - http://www.officehelp.in |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
HTML olAppointment Body? | Tony Gravagno | Add-ins for Outlook | 5 | December 19th 06 09:53 PM |
HTML in Task Body | K Passaur | Outlook and VBA | 2 | August 21st 06 05:22 AM |
mailto - html in body | Giorgio | Outlook Express | 7 | June 21st 06 02:41 PM |
Graphics in HTML Body | GeorgeMar | Outlook and VBA | 2 | February 27th 06 02:17 PM |
sending html in body of outlook xp email | Help a Novice Please | Outlook - General Queries | 3 | February 22nd 06 06:50 AM |