• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1966
  • Last Modified:

How to implement HTMLBody in Outlook OlMailItem

I am usng a VB script to create an Outlook email taking the message body from an open Word Document..

the current code is..

    Set oItem = oOutlookApp.CreateItem(olMailItem)
    With oItem
        .Subject = mysubject
        .Body = Source.Sections(j).Range.Text..

I want to use HTMLBody instead.. how do I get Source.Sections(j).Range.Text to appear in say a <p>
tag?
0
chrisfixit
Asked:
chrisfixit
  • 2
1 Solution
 
David LeeCommented:
Hi, chrisfixit.

This should do it.

    .HTMLBody = "<p>" & Source.Sections(j).Range.Text & "</p>"

Also, be sure to set the body format to HTML.  

    .BodyFormat = olFormatHTML
0
 
chrisfixitAuthor Commented:
Thanks but in the end I saved the Doc as HTML then used the text File as soucre for HTMLBody.
0
 
David LeeCommented:
You're welcome.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now