PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming build a string from HTML to modify template

Reply

build a string from HTML to modify template

 
Thread Tools Rate Thread
Old 13-12-2006, 02:25 PM   #1
Bob
Guest
 
Posts: n/a
Default build a string from HTML to modify template


I need to be able to automatically send a HTML template in response to
a rule in Outlook 2003.

It seems that for me to do this I need to be able to make a string from
an existing HTML template,
insert a string with the customer's name in the proper section of the
HTML string, then insert the entire string back into the template as
objItem.HTMLBody = strHTML.

Problem is I don't know how to build a string from HTML.

Can anyone offer any suggestions or point me in a direction where I can
find some examples on converting HTML code into a string. I need to
preserve all formatting and hyperlinks.

Thank you in advance for your assistance!

Bob

  Reply With Quote
Old 15-12-2006, 01:37 PM   #2
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: build a string from HTML to modify template

You don't need to know any HTML for that task. Create an .oft file with placeholder text where you want the name to appear. I use tokens like %name%. Then load the template and use Replace():

Set itm = Application.CreateItemFromTemplate("C:\myfile.oft")
itm.HTMLBody = Replace(itm.HTMLBody, "%name%", _
"customer_name")
etc.

--
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

"Bob" <technobob@bellsouth.net> wrote in message news:1166019932.929489.324540@j72g2000cwa.googlegroups.com...
>I need to be able to automatically send a HTML template in response to
> a rule in Outlook 2003.
>
> It seems that for me to do this I need to be able to make a string from
> an existing HTML template,
> insert a string with the customer's name in the proper section of the
> HTML string, then insert the entire string back into the template as
> objItem.HTMLBody = strHTML.
>
> Problem is I don't know how to build a string from HTML.
>
> Can anyone offer any suggestions or point me in a direction where I can
> find some examples on converting HTML code into a string. I need to
> preserve all formatting and hyperlinks.
>
> Thank you in advance for your assistance!
>
> Bob
>

  Reply With Quote
Old 15-12-2006, 07:34 PM   #3
Bob
Guest
 
Posts: n/a
Default Re: build a string from HTML to modify template

Thank you for taking the time to explain.

Regards,

Bob
Sue Mosher [MVP-Outlook] wrote:
> You don't need to know any HTML for that task. Create an .oft file with placeholder text where you want the name to appear. I use tokens like %name%. Then load the template and use Replace():
>
> Set itm = Application.CreateItemFromTemplate("C:\myfile.oft")
> itm.HTMLBody = Replace(itm.HTMLBody, "%name%", _
> "customer_name")
> etc.
>
> --
> 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
>
> "Bob" <technobob@bellsouth.net> wrote in message news:1166019932.929489.324540@j72g2000cwa.googlegroups.com...
> >I need to be able to automatically send a HTML template in response to
> > a rule in Outlook 2003.
> >
> > It seems that for me to do this I need to be able to make a string from
> > an existing HTML template,
> > insert a string with the customer's name in the proper section of the
> > HTML string, then insert the entire string back into the template as
> > objItem.HTMLBody = strHTML.
> >
> > Problem is I don't know how to build a string from HTML.
> >
> > Can anyone offer any suggestions or point me in a direction where I can
> > find some examples on converting HTML code into a string. I need to
> > preserve all formatting and hyperlinks.
> >
> > Thank you in advance for your assistance!
> >
> > Bob
> >


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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