If you have many iCalendar (.ics) files in your local drive and would like to batch open them in Outlook, you can read this article. Here we’ll teach you to utilize VBA code to realize it.
Normally, to open an iCalendar (.ics) file in your Outlook, you can easily make use of the “Import” feature. However, if you want to batch open many, “Import” is helpless as it doesn’t support you to select more than one file at once. Hence, you have to use other approaches.
If these ics files are stored in the same local folder, you can select them and press “Enter” key to open them in bulk. But, if they’re located in different folders under a drive, the above way is useless as well. In this case, you can use the following method, which can process all folders under a main folder recursively. Now, read on to get its details further.
Batch Open Multiple iCalendar (.ics) Files
- For a start, launch your Outlook program.
- Then, tap on “Alt + F11” to access VBA editor.
- After that, in the new window, input the following VBA code into a module.
Sub BatchOpenMultipleICalendarFiles() Dim objShell, objWindowsFolder As Object Dim strWindowsFolder As String 'Select a Windows Folder Set objShell = CreateObject("Shell.Application") Set objWindowsFolder = objShell.BrowseForFolder(0, "Select a folder:", 0, "") If Not objWindowsFolder Is Nothing Then strWindowsFolder = objWindowsFolder.self.Path & "\" Call LoopFolders(strWindowsFolder) MsgBox "Completed!", vbInformation + vbOKOnly, "Open iCalendar Files" End If End Sub Sub LoopFolders(strFolderPath As String) Dim objFileSystem As Object Dim objFolder As Object Dim objFile As Object Dim objICalendarFile As Object Set objFileSystem = CreateObject("Scripting.FileSystemObject") Set objFolder = objFileSystem.GetFolder(strFolderPath) 'Open each iCalendar file For Each objFile In objFolder.Files If LCase(objFileSystem.GetExtensionName(objFile)) = "ics" Then Set objICalendarFile = objFile On Error Resume Next Application.GetNamespace("MAPI").OpenSharedFolder objICalendarFile.Path End If Next If objFolder.SubFolders.Count > 0 Then For Each objSubfolder In objFolder.SubFolders If ((objSubfolder.Attributes And 2) = 0) And ((objSubfolder.Attributes And 4) = 0) Then Call LoopFolders(objSubfolder.Path) End If Next End If End Sub
- Next, move your cursor in “BatchOpenMultipleICalendarFiles” subroutine.
- Ultimately, press “F5” to trigger this macro.
- Subsequently, in the popup dialog box, select a Windows folder or drive where the iCalendar files are stored.
- When you receive “Completed” message, access “Calendar” pane in Outlook.
- You can see that all the iCalendar files in that Windows folder have been over there, like the following screenshot:
Prepare a Formidable PST Fix Tool Nearby
Perhaps you have known that Outlook is prone to errors and corruption. Thereby, it is advisable to back up your Outlook data files at regular intervals. In this way, even though your Outlook file becomes compromised, you can simply bring back valuable Outlook data from backups. Yet, if there is no such a backup, you would need to use a remarkable repair tool, like DataNumen Outlook Repair. It can help you to fix Outlook issues like a cork.
Author Introduction:
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover mdf and outlook repair software products. For more information visit www.datanumen.com