Insert name into outlook template

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using CreateItemFromTemplate to create a message from an Access 2000 database. How can I insert a "Dear NAME," line into the body of the message. I would like to replace NAME with a field in the database

Thanks!
 
Set the Body or (better yet) the HTMLBody property of the newly created message to the text you want to display.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
When I set the Body or HTMLBody properties, all of the formatting and the text in the template goes away.
 
That's why you want to set HTMLBody, not Body. And you need to set it to the complete text that you want to see. In other words, you need to merge what you want to insert with the template contents. Using a placeholder that you can quickly find with Replace() would be one approach.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
I tried setting HTMLBody. It replaces the entire body contents and removes formatting just like setting Body. How do I reference the template's text and formatting? Or how can I read the template file and concatenate it with the text I want to merge? Or how can I set formatting in the body of the email? The user wants to set a theme, and bold, highlight, and change font size for certain sections of the text. The template gets me 90% there.
 
Read my message again. If the message already includes text and other formatting, you have to build a string that includes *the original text and formatting* plus *your new text* and then set HTMLBody to that string.

The original text is contained in the original HTMLBody property of the message you create with the template. You will have to work with the HTML tags with string functions or, if you're more comfortable with straight HTML, use GetInspector.HTMLEditor to return an HTML Document Object model representation of the HTML content.

Please take the time to quote the original message so that people reading your current response can understand what you're talking about. Otherwise, you may not receive the answer you're looking for.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Back
Top