How to Batch Close All Outlook PST Files at Once in Your Outlook

If you have opened multiple Outlook PST files in your Outlook and now you wish to close all of them in bulk, you can refer to this article. Here we will teach you a quick method to accomplish it in one go.

In my previous article – “How to Batch Open Multiple Outlook PST Files at Once in Your Outlook”, I’ve introduced a smart way to open many Outlook PST files in one go. Similar to that, many users ask for a solution to bulk close all Outlook PST files. Therefore, we will expose such a way with the detailed steps and VBA code.

Batch Close All Outlook PST Files at Once in Your Outlook

Batch Close All Outlook PST Files at Once

  1. To begin with, launch your Outlook program properly.
  2. Then, you need to press “Alt + F11” key shortcut in your Outlook window.
  3. Next, in the new VBA editor window, you can get access to an empty module, namely one that is being used.
  4. Subsequently, you can copy the following VBA code into this module.
Sub CloseAllOutlookPSTFiles()
    Dim objStores As Outlook.Stores
    Dim objStore As
    Dim objOutlookFile As Outlook.folder
    Dim i As Integer
    'Get All Outlook Files in Your Outlook
    Set objStores = Outlook.Session.Stores
    For i = objStores.count To 1 Step -1
        Set objStore = objStores.Item(i)
        Set objOutlookFile = objStore.GetRootFolder
        'Exclude the Outlook OST File for Exchange mailbox
        If objStore.ExchangeStoreType = olNotExchange Then
           'Close the PST File
           Outlook.Session.RemoveStore objOutlookFile
        End If
    Set objStores = Nothing
    Set objStore = Nothing
    Set objOutlookFile = Nothing
End Sub

VBA Code - Batch Close All Outlook PST Files at Once

  1. After that, you can run this macro.
  2. Just click the “Run” icon in the menu bar or press “F5” key button.
  3. At once, the macro will begin running.
  4. When it completes, you can go back to the mail navigation pane, where you’ll see that all the opened Outlook PST files have disappeared.

Utilize Outlook Inbox Repair Tool

Due to Outlook’s vulnerability, Microsoft provides users with an inbox repair tool – Scanpst.exe. If you’re simply a novice of Outlook, you may be unable to find and launch it. Actually, you can just access the installation folder of MS Outlook. This inbuilt utility is over there. Though this tool brings users with much convenience, if your Outlook is damaged seriously, it still cannot make effects. Generally, at that time, your last resort is to employ an external tool, such as DataNumen Outlook Repair. It is well versed at Outlook repair. That is to say, it can recover PST data in a quick time without any fuss.

Author Introduction:

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

Comments are closed.