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.
The MapCalendarLocation 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 3 preconfigured mapping services namely;
Aside from selecting the mapping service to be used, you can also specify if you only want 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.
Use the following instructions to configure the macro in Outlook;
- Download this code-file (
mapit4meetings.zip) or copy the code below.
- Open the VBA Editor (keyboard shortcut ALT+F11).
- Extract the zip-file and import the
mapit4meetings.basfile via File-> Import…
If you copied the code paste it into a new module.
- Optionally; customize the code to select a different mapping service, enable driving directions and to set a starting location.
- Sign your code so you won’t get any security prompts and the macro won’t get disabled.
- Add a button for easy access to the macro or press ALT+F8 and select the macro you want to execute.
Add a button to the Ribbon or the QAT to execute the MapCalendarLocation macro.
Using and 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.
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.
The location should be specified in the same format as you would normally use when directly using the respective website.
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.
If you want to use starting locations which you’ve saved with the mapping service, set the DrivingDirections variable to “True” and adjust the FromString variable to;
FromString = ""
This will leave the field empty and allows you to select a saved address in the mapping service.
For instance, with Google Maps, the default is “Your location” and all you have to do is press the Search button. If the address is set in code, the search is automatic.
The following code is contained in the zip-file referenced in the Quick Install. You can use the code below for review or manual installation.
Click in the area above and press CTR+A to select all. Press CTRL+C to copy the code.