How to Quickly Create a Series of Countdown Appointments with Outlook VBA

If you want to create several appointments which are correlative, you can use the method introduced in this article. It permits you to create a series of countdown appointments simply by a button with Outlook VBA.

Occasionally, in Outlook, you may need to create a series of appointments, such as several appointments counting down to a specific date. In this situation, if you create them one by one, you must feel troublesome. Of course, you can use Excel to create the countdown appointments just via the method in our precious article – “2 Steps to Create Countdown Appointments in Outlook Calendar”. Though it seems much easier than manual creation, it is still a bit messy as you still have to create a CSV file and then import them into Outlook. Actually, if you can make use of Outlook VBA, then it will be considerably simple and quick. Here are the detailed steps and VBA codes.

Quickly Create a Series of Countdown Appointments

  1. In the first place, you can start Outlook application and turn to “Developer” tab. If you cannot find this tab, you should go to “File” > “Options” > “Customize Ribbon” to activate it.Activate the Developer Tab
  2. Then click the “Visual Basic” button under this tab. You will access the VBA editor window at once.
  3. Subsequently, you should open a module that is not in use. And then copy the following VBA codes into it.
Sub CreateSeveralAppointments()
    Dim objAppointment As Outlook.AppointmentItem
    Dim i As Long
    Dim dDate As Date
    Dim dStart As Date
    Dim dEnd As Date
    Dim strSubject As String
 
    For i = 1 To 6
 
        Set objAppointment = Outlook.Application.CreateItem(olAppointmentItem)
        'change the settled date as per your actual needs
        dDate = #3/25/2017#

        Select Case i
               Case 1
               'count down by week
               dStart = dDate - 7
               dEnd = dStart + 1
               'change the subject to your case
               strSubject = i & " weeks before XXX"
 
               Case 2
               dStart = dDate - 14
               dEnd = dStart + 1
               strSubject = i & " weeks before XXX"

               Case 3
               dStart = dDate - 21
               dEnd = dStart + 1
               strSubject = i & " weeks before XXX"
 
               Case 4
               dStart = dDate - 28
               dEnd = dStart + 1
               strSubject = i & " weeks before XXX"
 
               Case 5
               dStart = dDate - 35
               dEnd = dStart + 1
               strSubject = i & " weeks before XXX"
 
               Case 6
               dStart = dDate - 42
               dEnd = dStart + 1
               strSubject = i & " weeks before XXX"
 
              'you can add more as per your needs
        End Select

        With objAppointment
             .Start = dStart
             .End = dEnd
             .Subject = strSubject
             .Save
        End With
 
    Next
End Sub

VBA Codes - Create a Series of Countdown Appointments

  1. After that, you ought to close the VBA editor and add the new VBA project to Quick Access Toolbar (QAT) or ribbon. Here we take QAT as an example.
  • Firstly click down arrow in the Quick Access Toolbar.
  • Then select “More Commands” from the drop down list.
  • Subsequently, add the new macro to Quick Access Toolbar.
  • Lastly click “OK” button to save the changes.Add the New VBA Project to QAT
  1. Eventually you can try this macro.
  • At first, click the corresponding button in QAT.
  • At once, several appointments will be created in your Outlook default calendar, similar to the following screenshot.Countdown Appointments Created via Outlook VBA

What to Do If Outlook PST Data Gets Compromised

Due to the fact that Outlook PST data is quite vulnerable, you should make many preparations. For instance, you should back up your PST files on a regular basis. Plus, keep closing your Outlook properly. Moreover, apart from the built-in repair tool, Scanpst.exe, it is prudent to keep another one, which should be much more experienced and reputable tool, such as DataNumen Outlook Repair. With such a tool, you will not need to fear Outlook PST file error.

Author Introduction:

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

Comments are closed.