Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Using VBA to edit mail body without losing embedded pictures? (http://www.outlookbanter.com/outlook-vba/8829-using-vba-edit-mail-body.html)

[email protected] March 20th 06 12:59 PM

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.


Ken Slovak - [MVP - Outlook] March 20th 06 06:05 PM

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.



Sue Mosher [MVP-Outlook] March 20th 06 08:38 PM

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.




All times are GMT +1. The time now is 08:39 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com