Creating a new appointment based on an existing one

New Appointment buttonUnlike the Contacts module, which has a feature to create a new contact from the same company, the Calendar module doesn’t hold a feature to directly create a new appointment based on the current one. If there is no direct recurrence pattern, having such an option for appointments can be useful so you can use it as a template.

Luckily, with some VBA, it is fairly easy to create a new appointment based on an existing one similar to that of creating a new contact from the same company.

This guide provides you with that VBA code and not only explains how to implement it but also explains how to configure which appointment properties should be copied to the new appointment.


Background information

This request came from a support engineer who visits various companies and usually stays there for a couple of days. The subject of the appointment contains information such as the company name and support number. The location contains the actual location and the body contains information such as links to the documentation for that company’s environment, links to local hotels and driving instructions. In addition, there are various categories linked to the appointment.

Recreating such an appointment for every visit is rather cumbersome.

We’ve tried the following methods before deciding upon a VBA solution:

  • Use CTRL+C and CTRL+V. Sadly, this will only result in the the subject being copied in a new appointment in case of an All Day Event. As these bookings were made as All Day Events (spanning multiple days), this was not an option.
  • Use CTRL+SHIFT+Y to bring up the Copy to Folder dialog and then copy the item to the Calendar to create a duplicate. This was somewhat workable but could cause issues in case the reminder was already dismissed.
  • Use the the right mouse button to drag and drop the item on a date within the Date Navigator and choose to create a copy. This had the downside that you had to go to that date afterwards when you wanted to change the details of the item.

There were various other side issues as well which makes a copy not the ideal solution. Creating a new appointment and only copying over the needed fields is a much cleaner solution.

Long story short; We decided to take the VBA route!

OpenAppointmentCopy VBA macro

The OpenAppointmentCopy macro had to meet the following criteria to call it a solution:

  • It had to create a new Appointment item.
  • It has to work for All Day Events and regular Appointment items.
  • Selecting which properties to copy should be easily adjustable in the code.
  • It has to work for items selected directly in the Calendar as well as from individually opened Appointment items in their window.
  • The new Appointment item should be displayed so that modifications can be made to it.

Needless to say, the macro from this guide can do all of the above and is compatible with all versions of Outlook.

By adding a button for the macro to both the main Outlook window and the Appointment item window, you have quick access to it and it would function similarly to the “Contact from the Same Company” option that you have when creating contacts.

Add a button to the QAT of an opened appointment item to quickly create a copy.
Add a button to the QAT of an opened appointment item to quickly create a copy.

Quick Install

Use the following instructions to configure the macro in Outlook;

  1. Download this code-file (openapptcopy.zip) or copy the code below.
  2. Open the VBA Editor (keyboard shortcut ALT+F11)
  3. Extract the zip-file and import the OpenApptCopy.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.

When you place the button on the Appointment tab of the Calendar Tools section, you’ll have direct access to it when selecting the appointment in the Calendar.
When you place the button on the Appointment tab of the Calendar Tools section, you’ll have direct access to it when selecting the appointment in the Calendar.

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.

Modifications

Making modifications to the code to select which properties should be copied is quite easy, even when you haven’t worked with VBA macros before.

Towards the end of the code, you’ll find a comment “Copy the desired details to a new appointment item” and a “With olApptCopy” statement a few lines below. This is where the magic happens.

You can delete a line or add one of your own. By typing a dot ( . ), you can see which properties are available. For instance, to copy over the mileage field add the following line:

.Mileage = olAppt.Mileage