Copy Recurring Appointment Series to Appointments

Last reviewed on August 5, 2013

Applies to Microsoft Outlook 2010, Outlook 2007, Outlook 2003, Outlook 2002

This code creates appointments from a selected recurring appointment. It picks up the appointment's start date (see warning below!) and creates appointments from the start date up to 30 days in the future, if the recurring appointment does not have an end date set.

The code gets the subject from the date of the selected appointment and creates a filter, so only the selected recurring appointment series is copied to appointments. If you have more than one appointment series with the same subject, appointments will be created for each series, since the filter uses the subject. Edit the subject of the series you want to copy so it is unique.

If you just need a list of dates, see How to print a list of recurring dates using VBA. To copy just a single occurrence to an appointment, see Copy Selected Occurrence to Appointment.

Using the macro

This macro was tested in Outlook 2010, Outlook 2007 and Outlook 2003. It should work with at least Outlook 2002 as well (it's built off the Outlook 2002 macro listed in More Information).

However, the filter (sFilter) needs to be edited for older versions, as [IsRecurring] does not work. Use this instead:

sFilter = “[Start] >= ’1/1/2000′ And [End] < '" & tEnd & "' And [Subject] = " & strSubject

Also, leading or ending spaces (" My Appointment" or "My Appointment ") in the subject will cause the macro to fail with 0 appointments found. Removing the spaces from the subject should take care of it. You could also move or copy the recurring appointment to a new Calendar folder and remove the subject filter.

When you select an appointment in Day/Week/Month view, the start date is for the selected occurrence, not the first appointment in the series. When you select the series in list view, it will use the very first date of the appointment. For this reason, I recommend using list view with this macro. I also recommend leaving the Message Box popup in the code and assigning categories to the copies. It makes it easier to identify inconsistencies before removing the original appointment series. See Tweaking the Macro for additional filter options

I recommend testing this macro first by creating (or copying) a recurring event (or two) to a second Calendar folder and running the code while viewing that folder.

Run a macro from the Developer tab
Outlook 2010 users can customize the QAT or ribbon with a button for the macro (File, Custom ribbon or Quick Access toolbar commands) or you can show the Developer ribbon and run it from the Macros button.

In older versions of Outlook, run the macro from the Tools, Macros menu or customize the toolbar and assign the macro to a toolbar button.

Convert Recurring Appointments to Appointments

Open the VBA Editor using Alt+F11. Expand the Project to display ThisOutlookSession on the left. Double click to open it and paste the code below into the right side. Select a calendar folder then run the macro.

To use, select a recurring appointment or meeting and run the macro. I highly recommend using list view when you use this macro.

Press the Break key on your keyboard to end macro if it is running longer than a few minutes and you are not using a date filter.

Sub ConvertRecurring()
   
   Dim CalFolder As Outlook.MAPIFolder
   Dim CalItems As Outlook.Items
   Dim ResItems As Outlook.Items
   Dim sFilter, strSubject As String
   Dim iNumRestricted As Integer
   Dim itm, newAppt As Object
   Dim tStart, tEnd As Date
 
   ' Use the selected calendar folder
   Set CalFolder = Application.ActiveExplorer.CurrentFolder
   
   ' Get all of the appointments in the folder
   Set CalItems = CalFolder.Items

   ' Sort all of the appointments based on the start time
   CalItems.Sort "[Start]"

   ' Include the recurrences from the selected date forward
   CalItems.IncludeRecurrences = True
   
   ' Pick up the Start Date of the selected appointment occurrence 
   ' Use a List view to get all occurrences
    tStart = Format(Application.ActiveExplorer.Selection.Item(1).Start, "Short Date")

    'end date 30 days from today
    tEnd = Format(Now + 30, "Short Date")
    
   ' Pick up the selected appointment's subject
    strSubject = Application.ActiveExplorer.Selection.Item(1).Subject
 
   'create the Restrict filter
   sFilter = "[Start] >= '" & tStart & "'" & " And [End] < '" & tEnd & "' And  [IsRecurring]  = True And [Subject] = " & strSubject

   ' Apply the filter to the collection
   Set ResItems = CalItems.Restrict(sFilter)

   iNumRestricted = 0

   'Loop through the items in the collection. 
   For Each itm In ResItems
      iNumRestricted = iNumRestricted + 1
      
  Set newAppt = ActiveExplorer.CurrentFolder.Items.Add(olAppointmentItem)

  newAppt.Start = itm.Start
  newAppt.End = itm.End
  newAppt.Subject = itm.Subject & " (Copy)"
  newAppt.Body = itm.Body
  newAppt.Location = itm.Location
  newAppt.Categories = "Test Code, " & itm.Categories
  newAppt.ReminderSet = False
  
' Copies attachments to each appointment.
  If itm.Attachments.Count > 0 Then
    CopyAttachments itm, newAppt
  End If
        
  newAppt.Save

   Next

   ' Display the actual number of appointments created
     MsgBox (iNumRestricted & " appointments were created"), vbOKOnly, "Convert Recurring Appointments"

   Set itm = Nothing
   Set newAppt = Nothing
   Set ResItems = Nothing
   Set CalItems = Nothing
   Set CalFolder = Nothing
  
End Sub

Sub CopyAttachments(objSourceItem, objTargetItem)
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set fldTemp = fso.GetSpecialFolder(2) ' TemporaryFolder
   strPath = fldTemp.Path & "\"
   For Each objAtt In objSourceItem.Attachments
      strFile = strPath & objAtt.FileName
      objAtt.SaveAsFile strFile
      objTargetItem.Attachments.Add strFile, , , objAtt.DisplayName
      fso.DeleteFile strFile
   Next

   Set fldTemp = Nothing
   Set fso = Nothing
End Sub


Tweaking the Macro

If you want to create appointments for all recurring series in the selected calendar, remove the subject from the filter and use a generic start date, or hard-code a date. By using a start date far in the past, you can select any date in the Day, Week, or Month view.
Remember: [IsRecurring] doesn't work in Outlook 2007 and under.

Use a filter with the start date hard-coded:

  sFilter = "[Start] >= '1/1/2000' And [End] < '" & tEnd & "' And  [IsRecurring]  = True And [Subject] = " & strSubject

Use a start date in the past:

tStart = Format(Now - 365, "Short Date")

sFilter = "[Start] >= '" & tStart & "'" & " And [End] < '" & tEnd & "' And  [IsRecurring]  = True"

To include a list of meeting invitees in the appointment body, use

newAppt.Body = "Attendees: " & itm.RequiredAttendees & itm.OptionalAttendees & vbCrLf & itm.Body

This will add your own name on appointments (you are always 'attending').

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlookforums.

17 responses to “Copy Recurring Appointment Series to Appointments”

  1. Mark Laforest

    Hi Dianne
    Howare you?
    You may recall I started that threat about changing the end date on recurring Appointments in Outlook and the problems it creates with past Appointments (losing notes and attachments).
    I think it prompted you to do this Macro.
    Have you considered making it more user friendly?
    My customers have no idea how to creat and run Macros. They just want to click a button and be asked a simple question like "What date range would you like to convert this series into single Appointments" and then for the program to do its bit.
    Would you like to do that? Would you like to quote me to do that?
    Thanks
    Mark
    Medical Business Systems.

  2. Mark Laforest

    Hi Diane
    Any progress?
    Thanks
    Mark.

  3. Jonathan

    Hi Diance,

    Thank you for the post, but I've had some issues implementing this macro in my team's particular situation.

    We have seven people making appointments for four training associates. We use a shared calendar on which we've partitioned out each day in 45-minute intervals for each associate's schedule. The training associate is invited to the meeting so that they receive any updates that are made to the appointment. The meetings are set to recur so that I didn't have to individually copy and invite each associate to each appointment each day.

    Since implementing this system, I've discovered all the issues that arise out of relying on exceptions made to recurring appointments. I tried this macro, but we use Outlook 2007, and either none of the exceptions are copied, or everything is copied, including the copies, creating an infinite loop.

    I presume the trouble boils down to the lack of the "IsRecurring" tag in 2007. Without it, Subject is the only limiting factor, and if you remove Subject, you open up everything to being copied.

    To avoid that, is there some way to add a category limiter to the macro? I notice that the macro adds the category of "Test Code" to copied appointments. Is there some way I can tell the macro to ignore any appointment that has "Test Code" as a category?

    Thank you very much.

    P.S. I've tried a few times to export and import the calendar, as I know this both breaks up the series and also maintains exceptions, but the import has scrambled the calendar each time I've tried. Some appointments are fine, some are way off, and some just disappear into the ether.

  4. Jonathan

    Thank you very much for the quick response. I tried the filter, but wasn't able to get it to work in Outlook 2007, either. About the same time, I made the realization that shifting to individual appointments won't solve the dilemma I have, and I abandoned the venture.

    Thanks, again, for trying to help. I greatly appreciate it.

  5. Ed Roberts

    This code worked perfectly in Outlook 2010 in converting a recurring appointment with many exceptions into individual appointments with all the exception information preserved. THANK YOU!!

    This was truly a life saver and will gets lots of use.

    The new appointment subjects are all appended with "(Copy)". Is there a global way of renaming a portion of the list view so that I can eliminate those extra characters (like find/replace perhaps)? I can find them easily enough with the Test Code category. Or would REMing the line "newAppt.Subject = itm.Subject & " (Copy)"" be easier?

    Thanks, again.

  6. Ed Roberts

    Diane,
    That did the trick. I re-ran the macro with the edited itm.subject line and everything looks just the way I wanted. Removing the messages with the appended subject lines was simple in View/List mode.
    Thanks, again!
    Ed

  7. totalflex

    Great macro, it does the job. Thank you for sharing it.

    I have one simple question:

    Is there a way to also copy "show as" value from the original recurring appointment to the copied one?

    The free, out of office and busy are so meaningful for my particular case...

  8. Bart Stouten

    Hi Diana,

    Thank you for this beautiful macro. In Outlook 2010 I encountered a problem when the first word in the Subject was 'All'. Changing the sFilter line to

    sFilter = "[Start] >= '" & tStart & "'" & " And [End] < '" & tEnd & "' And [IsRecurring] = True And [Subject] = """ & strSubject & """"

    solved the problem.

  9. Dave Schmied

    Is there a way to include and update attendees of each recurrence? Or, is there some way to delete the original without sending a cancellation to attendees?

  10. Van Knowles

    This a great macro, and very instructive to those of us who are sort of middling VBA coders.

    In Outlook 2007, I was able to find the recurrence start date even in Day/Week/Month view by using the RecurrencePattern object:

    Dim FocalItem As AppointmentItem
    Dim FocalRecur As RecurrencePattern
    ...
    Set FocalItem = Application.ActiveExplorer.Selection.Item(1)

    Set FocalRecur = FocalItem.GetRecurrencePattern

    ' Pick up the Start Date of the selected appointment occurrence
    tStart = Format(FocalRecur.PatternStartDate, "Short Date")

    I have not tested this extensively, so maybe there are pitfalls I'm not aware of. I don't know which versions of Outlook include this object, but it exists and seems to work in 2007.

    FYI

  11. Devin

    Hi. Thanks for the code. I actually am at this page to include the 'Sub CopyAttachments(...) into the 'Create a Task From Email' code you provided elsewhere. It throws a run-time error 424 ('object required') at:

    'For Each objAtt In objSourceItem.Attachments'

    It appears that the objAtt is not defined, and I can't see where this comes from. Could you help me with this? Thanks.

Leave a Reply

If the Post Coment button disappears, press your Tab key.