How to Batch Open Multiple Outlook PST Files at Once in Your Outlook

By default, Outlook doesn’t support you to open several Outlook PST files in bulk. In this article, we will teach you how to use VBA to batch open multiple Outlook data files at once in your Outlook.

When you want to open additional Outlook PST files in your Outlook, generally, you have two means. One is to go to “Account Settings” dialog box and then shift to “Data Files” tab and next click “Add” button to select the Outlook file to open it. The other one is to head to “File” menu in Outlook window and then click “Open Outlook Data File” button under “Open” tab to select file. Both of them are handy. However, both the two ways only allow you to open a single PST file once. You are not permitted to open several ones in one go. Therefore, if you would like to bulk open more than one PST files, you have to seek other methods. Here we’ll teach you to use VBA to achieve it in quick time.

Batch Open Multiple Outlook PST Files at Once

Batch Open Multiple Outlook PST Files at Once

  1. In the first place, start your Outlook program.
  2. Then press “Alt + F11” key buttons in the main Outlook window.
  3. Next in the Outlook VBA editor, you should open a new module.
  4. Subsequently, copy and paste the following VBA codes into the module.
Sub BatchOpenMultiplePSTFiles()
 
    'You can change the path as per your needs
    'You can also specify a folder other than a drive
    'For instance - Call LoopFolders("C:\Users\Test\My Documents\Outlook Files")
    Call LoopFolders("E:\")
    MsgBox "Open Successfully!", vbExclamation + vbOKOnly, "Open Outlook Data File"

End Sub

Sub LoopFolders(strPath As String)
    Dim objFileSystem As Object
    Dim objFolder As Object
    Dim objFile As Object
    Dim objPSTFile As Object
 
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFileSystem.GetFolder(strPath)
 
    For Each objFile In objFolder.Files
        'Find the pst file by file extension
        strFileExtension = objFileSystem.GetExtensionName(objFile)
        If LCase(strFileExtension) = "pst" Then
           Set objPSTFile = objFile
           'Open the PST file
           Outlook.Application.Session.AddStore (objPSTFile.Path)
        End If
    Next
 
    'Process all folders and subfolders in the Local Drive E
    If objFolder.SubFolders.Count > 0 Then
       For Each objSubFolder In objFolder.SubFolders
           'Skip the system and hidden folders
           If ((objSubFolder.Attributes And 2) = 0) And ((objSubFolder.Attributes And 4) = 0) Then
              LoopFolders (objSubFolder.Path)
           End If
       Next
    End If
End Sub

VBA Code - Batch Open Multiple Outlook PST Files at Once

  1. After that, change your Outlook macro security level to low.
  2. Eventually, you can click the “Run” icon in the toolbar of VBA editor or simply press F5 key to trigger this new VBA project.
  3. At once, all the Outlook PST files in the predefined local folder will be opened in batches.Several PST Files Get Opened

Fight against Vexing PST Errors

Since Outlook is susceptible to errors and corruption, you should pay attention to all potential threats, such as virus infections, improper Outlook shutdown as well as Outlook misconfigurations. All of them can cause Outlook corruption without breaking a sweat. Therefore, you have to back up your PST file on a regular basis. It will help a lot in later data recovery.

Author Introduction:

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

Comments are closed.