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.
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.
Use the following instructions to configure the macro in Outlook;
- Download this code-file (
addmileage.zip) or copy the code below.
- Open the VBA Editor (keyboard shortcut ALT+F11)
- Extract the zip-file and import the
AddMileage.basfile via File-> Import…
If you copied the code, paste it into a new module.
- 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.
Add a button to the Ribbon or the QAT to execute the AddMileage macro.
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.
To 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
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.