Driving directions for meeting locations

The mapping function in Outlook only works for contacts and a common request is to also get driving directions for appointments and meetings. This guide provides a macro for this and will explain how you can customize this macro. The customizations are selecting a mapping service of your choice and setting your starting location.


Appointment directions macro

The Appointment directions macro will allow you to use a web based mapping service to pinpoint the location of a meeting on a map and to also get driving directions to that place. For this it will use the address as specified in the "Location" field of the meeting or appointment.

The macro contains 4 preconfigured mapping services namely;

  • Bing Maps
  • Google Maps
  • MapQuest
  • Yahoo Maps

Aside from selecting the mapping service to be used, you can also specify if you to pinpoint the location on the map or to also get driving directions to that location. In case of the last, you'll also have to specify a starting location.

All these settings can be easily changed at the top part of the macro code.

Installing the macro (quick)

If you are already (somewhat) familiar with using VBA code in Outlook, you can use the installation instructions below. If you are not familiar with using VBA code in Outlook yet, click here to jump to the step-by-step part of the guide with more detailed installation instructions.

  1. Download this code-file (mapit4meetings.zip) or copy the code below.
  2. Open the VBA Editor (keyboard shortcut ALT+F11)
  3. Extract the zip-file and import the bas-file via File-> Import…
    If you copied the code paste it into a new module.
  4. Optionally; customize the code to select a different mapping service, enable driving directions and to set a starting location.
  5. Add a button for easy access to the macro.
  6. Sign your code.

If you've done things correctly, your macro should work now. If it doesn't, retrace your steps by following the step-by-step instructions below.


Installing the macro (step-by-step)

As I already provide you with the code, creating the macro is easy. The code should work for all supported Outlook and Windows combinations. It has been tested with Outlook 2002/XP and Outlook 2003 on Windows XP and with Outlook 2007 and Outlook 2010 on Windows 7.

Open the VBA Editor

Installing the macro goes via the VBA Editor in Outlook. In order to open it you can use the keyboard shortcut ALT+F11 or via;

  • Outlook 2007 and previous
    Tools-> Macro-> Visual Basic Editor
  • Outlook 2010
    tab Developer-> button Visual Basic

Note:
By default the Developer tab is hidden in Outlook 2010. To enable it use;
File-> Options-> Customize Ribbon-> enable the checkbox in front of Developer in the most right column.

 

Developer tab in Outlook 2010
You'll need to enable the Developer tab in Outlook 2010 first.

Creating the Macro

After opening the VBA Editor, you can directly import the code by downloading this zip-file (mapit4meetings.zip). Once you've extracted the zip-file, you can then easily import it via;
File-> Import…

Tip:
You can download and extract the zip-file to your Desktop for easy access to it. Once you've imported it, you can remove it from your Desktop again.

 

If you want to do it manually, you'll first have to create a new module via;
Insert-> Module

Select the newly created module in the left pane and rename it to "MapIt4Meetings" 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.

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

Customizing the macro

While the macro already works without needing to make any modifications to the code provided, you will have to modify the code if you want to change the mapping service that is being used or if you want to enable the route planner capabilities.

Instructions for the modifications needed are given at the top of the code. Read these carefully and do not edit anything below the "STOP EDITING" line.

Debug the code

Once you've copied over the code and (optionally) made any modifications to it, we now have to 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. If you made modifications to the code, copy over the code as given above and test if that works for you first. Debug until you’ve solved the errors (the code provided works correctly without any modifications).

Note:
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.

Using the macro

As mentioned, the macro works based on the "Location" field of the Meeting or Appointment. So, in order for this macro to work, make sure that you've specified this field.

For Bing Maps, Google Maps and Yahoo Maps, the location should be specified as you would normally do when directly using the respective website directly.

When you use MapQuest, you'll need to specify the location in the following manner;
street, city, state, zipcode, country

If you want to skip a certain detail, you'll still have to write the comma. For instance, if you want to skip the state and zipcode, you'll have to specify the address like this;
street, city, , , country

You can execute the macro either from an opened Meeting or Appointment item or directly from within the Calendar by selecting any Meeting or Appointment.

The keyboard shortcut for selecting a macro to execute is ALT+F8. To do it via a mouse use;

  • From the main Outlook window (Outlook 2007 and previous)
    Tools-> Macro-> Macros…
  • From the main Outlook window (Outlook 2010)
    tab Developer-> button Macros
  • From an opened Meeting or Appointment item (Outlook 2003 and previous)
    Tools-> Macro-> Macros…
  • From an opened item (Outlook 2007 and Outlook 2010)
    tab Developer-> button Macros

Tip:
An better method to have quick access to a macro is to create button for it. This button can be customized with an image and allows itself to be activated with a single mouse click or a direct keyboard shortcut.
To find out more see: Create a button for a macro

 

MapIt4Meeting icon
The MapIt4Meeting icon in the Toolbar.