As usual, when you copy a recurring task to calendar, the task’s recurrence will not be auto added to the new appointment. Thus, this article will share you a quick way to keep the recurrence, which is using Outlook VBA.
As we all know, Outlook not only permits users to create recurring appointments but also recurring tasks. At times, you may need to turn a task to an appointment. In this case, as normal, you have two means to accomplish it – drag the task to the destination calendar folder or press “Ctrl + C” and “Ctrl + V” key shortcuts to copy and paste it to the calendar. However, if the task is recurring, the above two ways will not keep the recurrence by default. Therefore, if you would like to include the recurrence when copying, you can use the following approach.
Keep the Recurrence When Copying a Recurring Task to Calendar as a New Appointment
- In the first place, launch your Outlook program.
- Then press “Alt + F11” key buttons to access VBA editor.
- Next in the new window, open a not-in-use module or insert a new module.
- Subsequently, copy and paste the following VBA codes into the target module window.
Public Sub CopyRecurringTaskstoCalendar() Dim objTask As Object Dim objTaskRecurrencePattern As Outlook.RecurrencePattern Dim objCalendarFolder As Outlook.Folder Dim objNewAppointment As Outlook.AppointmentItem Dim objAppointmentRecurrencePattern As Outlook.RecurrencePattern Dim nPrompt As Integer Set objTask = Outlook.Application.ActiveExplorer.Selection.Item(1) If TypeOf objTask Is TaskItem Then Set objTaskRecurrencePattern = objTask.GetRecurrencePattern 'Select a calendar to copy the select task to Set objCalendarFolder = Application.Session.PickFolder If objCalendarFolder.DefaultItemType = olAppointmentItem Then Set objNewAppointment = objCalendarFolder.Items.Add("IPM.Appointment") Set objAppointmentRecurrencePattern = objNewAppointment.GetRecurrencePattern With objNewAppointment .Subject = "From Task: " & objTask.Subject .Start = objTask.StartDate .End = objTask.DueDate .Body = objTask.Body .attachments.Add objTask End With 'Apply the task recurrence to the new appointment Set objAppointmentRecurrencePattern = objTaskRecurrencePattern 'Use ".Save" to save it straightly objNewAppointment.Display Else nPrompt = MsgBox("You should select a calendar folder!", vbExclamation, "Confirm Calendar Folder") End If Else nPrompt = MsgBox("You should select a task item!", vbExclamation, "Confirm Task Item") End If End Sub
- After that, you can exit the VBA editor.
- Later add the new macro to Quick Access Toolbar as usual.
- Also, remember to change your Outlook macro security level to low.
- Finally, you can have a try.
- Firstly, select a recurring task item.
- Then click the macro button in Quick Access Toolbar.
- Next you will be required to select a destination calendar folder which to copy the selected task to.
- Immediately the recurring task will be copied to the selected calendar folder. You can open that folder to check it.
Prepare for Occasional Troubles in Outlook
Since Outlook is considerably vulnerable, you should make sufficient precautions to avoid PST data loss. For instance, you have to back up the PST file regularly. In addition, it is also recommended to keep a potent repair tool, such as DataNumen Outlook Repair, in vicinity, which can help you to salvage corrupt Outlook data in time.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt sql and outlook repair software products. For more information visit www.datanumen.com