Record gas mileage for Appointments, Meetings, Contacts and Tasks

Even though Outlook has a field to record mileage for various items, aside from the Tasks item, it is nearly impossible to fill it out quickly.

While you could customize your Appointment and Contact forms or create a Form Region to make the field more readily available, those solutions are a bit of overkill just for this field alone. Another way to enter it would be to use a list view and enable in-cell editing but that would be quite cumbersome when you need to do it on a regular basis.

This guide contains a code sample which you can use to quickly log and retrieve your mileage for a selected or opened Appointment/Meeting, Contact item or Task.


AddMileage macro

The AddMileage macro allows you to enter or retrieve the mileage for a selected or opened Appointment/Meeting, Contact item or Task. This value is stored in the built-in Mileage field of that item.

When executing the macro, you’ll be prompted to enter the mileage. If you already have recorded mileage for that specific item before, then that is being displayed as well. When you only use numerals, then you can even do add and subtract calculations by placing a “+” or a “-“ in font of the mileage number.

Quickly record, see, add or subtract mileage info to your items.
Quickly record, see, add or subtract mileage info to your items.

Quick Install

Use the following instructions to configure the macro in Outlook;

  1. Download this code-file (addmileage.zip) or copy the code below.
  2. Open the VBA Editor (keyboard shortcut ALT+F11)
  3. Extract the zip-file and import the AddMileage.bas file via File-> Import…
    If you copied the code, paste it into a new module.
  4. Add a button for easy access to the macro.
  5. Sign your code.

Add a button to the Ribbon or the QAT to execute the AddMileage macro
Add a button to the Ribbon or the QAT to execute the AddMileage macro.

Macro Code

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.

Reporting mileage and add-in alternatives

Just recording your mileage probably isn’t enough. Most likely you’ll also need to report it at some point.

Simple report
To create a simple report which includes the mileage as well, you can use the method described in the guide: Reporting time spent on Meeting, Task and Journal items

VBOffice Reporter
To create a more sophisticated report, especially when you need to do it on a regular basis, the VBOffice Reporter add-in is highly recommended. The reports can be pre-configured and generated in an instant. The reporting templates can be adjusted to match your company’s standard layout and formatting and include the company’s logo.

Instyler Travel Add-in
Instyler Travel Add-in for OutlookWhen you travel a lot, the Instyler Travel Add-in for Outlook might be better suited than the macro. With this add-in, travel times can be scheduled automatically for you and blocked off in your Calendar. Mileage is also automatically recorded and driving directions are only a button click away. Afterwards, you can generate an expense report for one or multiple items. If you decide to order, use the code HOWTOOUTLOOK to get a discount upon checkout.