Open Message in Internet Browser

Outlook 2007 uses Word as the HTML rendering engine which could end up in a malformed display of the email message. In short; The Word HTML rendering engine doesn't provide support for things like gif and flash animations, advanced css formatting and HTML forms and accessibility.

This guide explains how you can render the message in a browser of your choice like Internet Explorer or Firefox by a click of a button. For more information on the Word HTML rendering engine and its implications click here. An additional benefit of opening the message in the browser is that you have the printing options of the browser available to you and therefore also the option to only print your selection.


Before we start this procedure, let me show you some examples of results you can achieve by using this macro.

Example 1 in Outlook

Example 1 in Browser

Example 2 in Outlook

Example 2 in Browser
Example 1 in OutlookExample 1 in BrowserExample 2 in OutlookExample 2 in Browser

Make sure the Visual Basic editor is installed

Since we are going to create a macro from code you must have the Visual Basic editor installed (which is the default). If you don't have it installed you can install it by Control Panel-> Add/Remove Programs-> select your Office version-> button change. Now setup will start. Here you choose for Add or Remove Features-> Select "Choose advanced customization of applications" (Outlook 2003). In the list you get expand Microsoft Office-> Office Shared Features-> Visual Basic for Applications and set it to Run form My Computer. Press "Update" to install. You might need to insert your CD during setup.

VB Editor menu
This is where you can find the Visual Basic Editor when you have it installed

Create Macro

As I already provide you with the code, creating the macro is easy. The code has been tested with Outlook 2003 on Windows XP and Outlook 2007 on Windows Vista but should work on previous versions as well.

We start up the Visual Basic Editor by going to Tools-> Macro-> Visual Basic Editor. This will open a new screen. Choose Insert-> Module to create a new module dedicated to this macro. Select the newly created module in the left pane and rename it to "InBrowser" by changing the Properties value in the pane underneath. Copy and paste the code below to the module.

Click in the area above and press CTR+A to select all. Press CTRL+C to copy the code

VB Editor (click on image to enlarge)
The code copied in the Visual Basic Editor. (click on image to enlarge)

You can define which browser to open the message with by editing the following line;
BrowserLocation = "C:\Program Files\Internet Explorer\iexplore.exe"
As you can see by default I've set it to open with Internet Explorer.

Now we debug the code by choosing Debug-> Compile Project1. You shouldn't be getting errors if you've done everything correctly.
If you do get errors retrace your steps and also verify that any previous code you might have in ThisOutlookSession is correct. Debug until you've solved the errors (the code provided works correctly without any modifications).

To be able to run the code without setting your macro security level to medium I recommend that you sign your code which is a very easy process and only takes a minute.

Create a button for the macro

You can run the macro through Tools-> Macros… -> select the OpenInBrowser macro and then press Run. However the easiest way to access and use the macro is to create a button for it. Since the macro works on the selected item we can create the button in the main Outlook window. Follow the instructions below to create a button.

  1. Set the Toolbar in edit mode by going to View-> Toolbars-> Customize…
  2. Select the tab Commands
  3. In the Categories column select Macros
  4. In the Commands toolbar click on Project1.OpenInBrowser and hold down the mouse button.
  5. Drag the icon to a location on the Toolbar so the pointer will loose the cross and release the mouse button to drop it in that location
  6. Right click the icon to change the name and to assign it a button image you like (if you want to learn more about editing Toolbar buttons click here)
  7. Press Close to leave edit mode

Save Attachments
The Save Attachments icon in the Toolbar. Curious on how my Save Attachments button works?

Using the macro

Alright, now that we've gone to all the trouble we can directly open a message in a browser with gif animations and the browser's accessibility support.