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

Using VBA to edit mail body without losing embedded pictures?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 20th 06, 12:59 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 2
Default Using VBA to edit mail body without losing embedded pictures?

Hi,

I want to send emails with pictures embedded, and I also want to be
able to fill in placeholder text in my email before they send, eg "Dear
Name".

Some of the relevant code I used to do this was:

dim ml as MailItem
strName = "Stuart"
ml.Body = Replace(ml.Body, "name", strName, , , vbTextCompare)

Unfortunately, as soon as I perform text operations on my body, it
turns the entire mail body to text, and loses the embedded images that
used to be there.

Does anyone have a solution for this one?

I even tried a softly softly approach like this:
ml.Body = "Dear " & strName & ml.Body
But even concatenating text turned the body into a string.

Assistance appreciated.

  #2  
Old March 20th 06, 06:05 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Using VBA to edit mail body without losing embedded pictures?

You would have to work with HTMLBody if you are using HTML messages.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
oups.com...
Hi,

I want to send emails with pictures embedded, and I also want to be
able to fill in placeholder text in my email before they send, eg "Dear
Name".

Some of the relevant code I used to do this was:

dim ml as MailItem
strName = "Stuart"
ml.Body = Replace(ml.Body, "name", strName, , , vbTextCompare)

Unfortunately, as soon as I perform text operations on my body, it
turns the entire mail body to text, and loses the embedded images that
used to be there.

Does anyone have a solution for this one?

I even tried a softly softly approach like this:
ml.Body = "Dear " & strName & ml.Body
But even concatenating text turned the body into a string.

Assistance appreciated.


  #3  
Old March 20th 06, 08:38 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Using VBA to edit mail body without losing embedded pictures?

.... and do some manipulation of the attachments to send embedded pictures; see http://www.outlookcode.com/d/code/htmlimg.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Ken Slovak - [MVP - Outlook]" wrote in message ...
You would have to work with HTMLBody if you are using HTML messages.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message
oups.com...
Hi,

I want to send emails with pictures embedded, and I also want to be
able to fill in placeholder text in my email before they send, eg "Dear
Name".

Some of the relevant code I used to do this was:

dim ml as MailItem
strName = "Stuart"
ml.Body = Replace(ml.Body, "name", strName, , , vbTextCompare)

Unfortunately, as soon as I perform text operations on my body, it
turns the entire mail body to text, and loses the embedded images that
used to be there.

Does anyone have a solution for this one?

I even tried a softly softly approach like this:
ml.Body = "Dear " & strName & ml.Body
But even concatenating text turned the body into a string.

Assistance appreciated.


 




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
Attached .pdf end up as embedded garbage in email body [email protected] Outlook - General Queries 6 March 20th 06 03:59 PM
send emails with embedded pictures that will open in outlook plain text Tim Outlook - General Queries 1 March 14th 06 09:50 AM
Body mail from MsWord Marcelo Outlook and VBA 0 February 6th 06 04:11 PM
How do I View & edit an OUTLOOK contact entry w. no e-mail or f JELY Outlook - Using Contacts 1 January 29th 06 01:55 PM
Photos embedded in body of text? Pete Stolz Outlook - General Queries 0 January 22nd 06 04:58 PM


All times are GMT +1. The time now is 11:18 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.