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
- To begin with, launch your Outlook program properly.
- Then, you need to press “Alt + F11” key shortcut in your Outlook window.
- Next, in the new VBA editor window, you can get access to an empty module, namely one that is being used.
- Subsequently, you can copy the following VBA code into this module.
Sub CloseAllOutlookPSTFiles() Dim objStores As Outlook.Stores Dim objStore As Outlook.store 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 Next Set objStores = Nothing Set objStore = Nothing Set objOutlookFile = Nothing End Sub
- After that, you can run this macro.
- Just click the “Run” icon in the menu bar or press “F5” key button.
- At once, the macro will begin running.
- 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.
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 www.datanumen.com