At times, you may hope to merge & export multiple Outlook calendars to a single iCalendar (.ics) file. Now, this article will help you get it in quick time.
From my previous article “2 Methods to Export a Specific Date Range of Your Outlook Calendar as an iCalendar (.ics) File“, you have learned the quick solution to export one calendar to one ics file. Nevertheless, sometimes, you may need to export multiple calendars to a single file. In such a case, you have to search other ways, such as the following one.
Merge & Export Multiple Outlook Calendars to a Single iCalendar (.ics) File
- To start with, enter Outlook VBA editor via “Alt + F11”.
- Then, copy and paste the following screenshot into a module.
Dim objTempCalendar As Outlook.Folder Sub ExportMultipleCalendars_SingleICalendarFile() Dim objRootFolder As Outlook.Folder Dim lCalendarCount As Long Dim i As Long Dim objSourceCalendar As Outlook.Folder Dim objCalendarItem As Outlook.AppointmentItem Dim objCopiedItem As Outlook.AppointmentItem Dim objMoviedItem As Outlook.AppointmentItem On Error Resume Next Set objRootFolder = Application.Session.GetDefaultFolder(olFolderCalendar).Parent Set objTempCalendar = objRootFolder.Folders.Add("Temp Calendar", olFolderCalendar) lCalendarCount = InputBox("Enter the count of calendars to be export", , "2") i = 1 Do While i <= lCalendarCount Set objSourceCalendar = Outlook.Application.Session.PickFolder If (Not (objSourceCalendar Is Nothing)) And (objSourceCalendar.DefaultItemType = olAppointmentItem) Then For Each objCalendarItem In objSourceCalendar.Items Set objCopiedItem = objCalendarItem.Copy Set objMoviedItem = objCopiedItem.Move(objTempCalendar) objMoviedItem.Save Next i = i + 1 End If Loop Call ExportCalendarToICalendarFile(objTempCalendar) objTempCalendar.Delete End Sub Sub ExportCalendarToICalendarFile(ByVal objCalendar As Outlook.Folder) Dim objExportedCalendar As Outlook.CalendarSharing Dim dStartDate As Date Dim dEndDate As Date Dim striCalendarFile As String Set objExportedCalendar = objCalendar.GetCalendarExporter dStartDate = InputBox("Input start date", "Start Date", "1/1/2018") dEndDate = InputBox("Input end date", "End Date", "1/31/2018") If dStartDate <> #1/1/4501# And dEndDate <> #1/1/4501# Then striCalendarFile = "E:\Calendar [" & Format(dStartDate, "YYYYMMDD") & " - " & Format(dEndDate, "YYYYMMDD") & "].ics" With objExportedCalendar .IncludeWholeCalendar = False .startDate = dStartDate .EndDate = dEndDate .CalendarDetail = olFullDetails .IncludeAttachments = True .IncludePrivateDetails = False .RestrictToWorkingHours = False .SaveAsICal striCalendarFile End With Call Shell("explorer.exe " & "E:\", vbNormalFocus) End If End Sub
- After that, follow the steps below to have a try.
- First, place cursor in the “ExportMultipleCalendars_SingleICalendarFile” macro and press “F5”.
- Then, in the input box, type the count of calendars you want to export.
- After that, you need to select the specific calendars in the “Select Folder” dialog box.
- Subsequently, specify the date range of calendar to be exported.
- When macro finishes, the predefined folder for saving the iCalendar file will be opened in Windows Explorer. There, you can find the exported ics file, as shown in the following screenshot.
Dispose of PST Troubles Flexibly
Maybe you have suffered various issues in your Outlook. Many of them are easy to be resolved. For instance, a restart in safe mode can fix them like a breeze. Yet, if the problems are so serious that they’ve been beyond what the inbox repair tool can do, you have to fall back on more powerful third party repair software, like DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf fix and outlook repair software products. For more information visit www.datanumen.com