How to Convert an HTML to an OFT

Written by matthew weeks
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Convert an HTML to an OFT
You can convert an HTML e-mail template to an OFT file with an Outlook macro. (Comstock/Comstock/Getty Images)

There are many companies and Web-based services that allow you to create templates for HTML e-mails. After using one for some time, you may feel the desire to switch to Microsoft Outlook for your e-mail delivery needs. However, if you are happy with the template you have created, you may want to bring it into Outlook as an OFT file for use in later mailings. Fortunately, through the use of an Outlook VBA module, you can easily convert an HTML file to an Outlook template.

Skill level:
Moderately Easy

Other People Are Reading


  1. 1

    Save your HTML e-mail template and all dependent files to your local drive.

  2. 2

    Start Microsoft Outlook and hit "ALT+F11" to bring up the Visual Basic editor. Select "Insert" and "Module" from the main navigational menu.

  3. 3

    Copy and paste the following code into your blank module:

    Sub MakeHTMLMsg()

    Set objMsg = Application.CreateItem(olMailItem)
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ts = fso.OpenTextFile("c:\testfile.htm", 1)
    strText = ts.ReadAll
    objMsg.HTMLBody = strText
    Set fso = Nothing
    Set ts = Nothing
    Set objMsg = Nothing

    End Sub

    Substitute the complete local path to your HTML file for the parameter of "OpenTextFile."

  4. 4

    Close the Visual Basic editor and run the macro you just created by hitting "ALT+11" in the Outlook window to bring up the macro window. Select "MakeHTMLMsg" from the list of macros and click the "Run" button to bring up your HTML template in an Outlook message.

  5. 5

    Select "File" and "Save As" from the navigational menu of your HTML template in Outlook to save your message as an OFT file.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.