How to Quickly Count the Occurrences of a Recurring Outlook Appointment in a Specific Date Range

Some users long for a quick solution to get a count of occurrences of a recurring appointment in a specific date range, since manually counting is pretty tedious. So, this article will introduce an effective way to you.

For some reasons, you may need to count the occurrences of a recurring Outlook appointment in a specific date range. In general, you can count them one by one in the calendar. However, without any doubts, it is quite troublesome and error prone. Therefore, here we will share you a much more convenient method.

Quickly Count the Occurrences of a Recurring Outlook Appointment in a Specific Date Range

Count the Occurrences of a Recurring Appointment in a Specific Date Range

  1. To start with, access your Outlook application.
  2. Then, open the Outlook VBA editor with reference to the article “How to Run VBA Code in Your Outlook”.
  3. After that, in the “Microsoft Visual Basic for Applications” window, copy and paste the following VBA code into a project or module.
Sub CountOccurrencesOfRecurringAppointment()
    Dim objRecurringAppointment As Outlook.AppointmentItem
    Dim strSubject As String
    Dim dStart, dEnd As Date
    Dim objCurrentCalendar As Outlook.Folder
    Dim objCalendarItems As Outlook.Items
    Dim objFoundItems As Outlook.Items
    Dim strFilter As String
    Dim lCount As Long
    'Get the specific recurring appointment
    Select Case Outlook.Application.ActiveWindow.Class
           Case olInspector
                Set objRecurringAppointment = ActiveInspector.CurrentItem
           Case olExplorer
                Set objRecurringAppointment = ActiveExplorer.Selection.Item(1)
    End Select
    If Not (objRecurringAppointment Is Nothing) Then
       strSubject = objRecurringAppointment.Subject
       'Specify the date range
       dStart = InputBox("Specify the start date:", , Format(objRecurringAppointment.Start, "Short Date"))
       dEnd = InputBox("Specify the end date:", , Format(Date + 30, "Short Date"))

       Set objCurrentCalendar = Application.ActiveExplorer.CurrentFolder
       Set objCalendarItems = objCurrentCalendar.Items
       objCalendarItems.Sort "[Start]"
       objCalendarItems.IncludeRecurrences = True
       'Find all occurrences in the date range
       strFilter = "[Start] >= '" & dStart & "'" & " And [End] < '" & dEnd & "' And [IsRecurring] = True And [Subject] = " & Chr(34) & strSubject & Chr(34)
       Set objFoundItems = objCalendarItems.Restrict(strFilter)
       lCount = 0
       'Start counting
       For Each objItem In objFoundItems
           lCount = lCount + 1
       'Prompt you
       MsgBox lCount & " occurrences of " & Chr(34) & strSubject & Chr(34) & " from " & dStart & " to " & dEnd & ".", vbOKOnly + vbInformation
    End If
End Sub

VBA Code - Count the Occurrences of a Recurring Appointment in a Specific Date Range

  1. Next, add the macro to Quick Access Toolbar for later convenient access.
  2. Eventually, you can try this macro.
  • First off, select or open the source recurring appointment.
  • Then, hit the macro button in Quick Access Toolbar.Run Macro through Quick Access Toolbar
  • At once, you will be required to specify the date range, like the following image:Specify Date Range
  • When macro completes, you will receive a message like the picture below, prompting the count of occurrences of the recurring appointment in the date range.Prompt the Count of Occurrences

Repair Compromised Outlook Data File

It is important for us to make clear how to repair compromised PST file in that Outlook file is vulnerable. That is to say, your file is in danger all the time. Thus, it is advisable to back up your Outlook file on a regular basis. Also, knowing how to launch the inbox repair tool is a matter of necessity. In addition, as Scanpst is not help a lot in case of serious issues, you’d better keep an external formidable tool in vicinity, like DataNumen Outlook Repair. It can solve most of Outlook problems and recover Outlook data like a breeze.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf repair and outlook repair software products. For more information visit

Comments are closed.