Record gas mileage for Appointments, Meetings, Contacts and Tasks

Record Gas Mileage buttonEven 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

Visual Basic buttonThe 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. Sign your code so you won’t get any security prompts and the macro won’t get disabled.
  5. Add a button for easy access to the macro.

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
Report Time Spent buttonTo create a simple report which includes the mileage as well, you can use the VBA or Excel method described in the guide: 3 Methods to report time spent on Meetings, Tasks and Journal items

VBOffice Reporter
VBOffice Reporter buttonTo 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.