Skip to content

Instantly share code, notes, and snippets.

@mrowles
Created December 11, 2012 22:36
Show Gist options
  • Save mrowles/4262972 to your computer and use it in GitHub Desktop.
Save mrowles/4262972 to your computer and use it in GitHub Desktop.
Microsoft Outlook: Create a new email message from an HTML file
Sub CreateHTMLMsg()
Dim sLocation As String
'Change this to the location of your HTML file
sLocation = "C:\HTML_Template.html"
Set objMsg = Application.CreateItem(olMailItem)
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(sLocation, 1)
strText = ts.ReadAll
objMsg.HTMLBody = strText
objMsg.Display
'Clear memory
Set fso = Nothing
Set ts = Nothing
Set objMsg = Nothing
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment