Outlook VBA code for HTML newsletter

This is an MS Outlook 2013 code to insert an HTML file into an email. File can have CSS definitions and external links to photos.

1- Go to file -> Options.2- In the “Customize Ribbon” section, check “Developer” in the Customize the Ribbon / Main Tabs panel (right) – Click OK
3- Open the Developer tab in the Ribbon. Click on Macros, Macros, Type “InsertHTML” and Create
4- In the Microsoft VBA window, click on tools -> References and make sure Microsoft Office 15.0 Object Library and Microsoft Word 15.0 Object Library are both checked- press OK
5- Copy and paste the following code:

Sub InsertHTML()
Dim insp As Inspector
Set insp = ActiveInspector
If insp.IsWordMail Then
Dim wordDoc As Word.Document
Set wordDoc = insp.WordEditor
Dim FileToOpen As String
FileToOpen = InputBox(“filename?”)
wordDoc.Application.Selection.InsertFile FileToOpen, , False, False, False
End If
End Sub

6- Save and close the Microsoft VBA editor
7- In the main menu, click on the developer tab in the ribbon, click on “Macro Security”. Select “Notification for all Macros”.8- Open a new message. Place the cursor in the empty message, go to Developer, click on Macro and select the Project1.InsertHTML macro.
9- When prompted enter the HTML file to import location.