Permanently Delete Empty Folders in Outlook PST 2019/2016

4 min read
How do I permanently delete PST files?

Microsoft Outlook is a leading email application that has been helping the professional workers to connect with each other since 2015. Crores of emails have been shared and thousands of deals have been made using this excellent application. Available as a part Microsoft Office Suite, this application is not restricted to just emails, but you can also use it as calendar, task manager, contact manager, notepad, journal book, and a web browser.

After having so many options, Microsoft Outlook still remains the primary application for transferring and receiving emails. So, it would not be an unusual situation that your inbox and sent folder might be brimming with thousands of emails which are not even needed anymore.

This article shall help you fix this situation by guiding you through the process of permanently deleting empty folders in MS Outlook, we have mentioned steps and also an effective tool such as stellar repair for outlook to recover deleted mails

How to permanently delete the Empty Folder in MS Outlook?

First of all, we need to understand that MS Outlook saves each and every file along with mailbox items in the format of .PST. So, when we are talking about deleting empty folders, we are referring to the .PST files that are sent to this folder.

To get through this process, you must follow the steps that are mentioned below:

  • Open the MS Outlook application in your computer system.
  • Now, press ‘Alt’ and ‘F11’ keys together to open the ‘Visual Basic’.
  • If not this, then you can simply click on the ‘Developer’ tab and go to the ‘Visual Basic’.
  • From there, you are required to go to the Insert menu and click on the Module option from the drop-box.
  • A new module window will open on your screen where you would be required to paste the below mentioned text. It is a VBA macro code which will help you delete the subfolders from the folders of MS Outlook.
Public Sub DeletindEmtpyFolder()

Dim xFolders As Folders

Dim xCount As Long

Dim xFlag As Boolean

Set xFolders = Application.GetNamespace(“MAPI”).PickFolder.Folders

Do

FolderPurge xFolders, xFlag, xCount

Loop Until (Not xFlag)

If xCount > 0 Then

MsgBox “Deleted ” & xCount & “(s) empty folders”, vbExclamation + vbOKOnly, “Kutools for Outlook”

Else

MsgBox “No empty folders found”, vbExclamation + vbOKOnly, “Kutools for Outlook”

End If

End Sub

Public Sub FolderPurge(xFolders, xFlag, xCount)

Dim I As Long

Dim xFldr As Folder ‘Declare sub folder objects

xFlag = False

If xFolders.Count > 0 Then

For I = xFolders.Count To 1 Step -1

Set xFldr = xFolders.Item(I)

If xFldr.Items.Count < 1 Then ‘If the folder is empty check for subfolders If xFldr.Folders.Count < 1 Then ‘If the folder contains not sub folders confirm deletion xFldr.Delete ‘Delete the folder xFlag = True xCount = xCount + 1 Else ‘Folder contains sub folders so confirm deletion FolderPurge xFldr.Folders, xFlag, xCount End If Else ‘Folder contains items or (subfolders that may be empty). FolderPurge xFldr.Folders, xFlag, xCount End If Next End If End Sub

  • Once you have pasted this VBA macro code, you must either press ‘F5’ or click on the ‘Run’
  • A window named ‘Select Folder’ will appear where you are supposed to select the folders from MS Outlook so that the application can delete the empty sub-folders.
  • Click on the ‘OK’ button to finish the process.
  • Confirm if the desired folders have been deleted correctly.
  • Restart the application before continuing using it.

What to do if I want to recover the permanently deleted empty folders?

In case you happen to delete some important .PST files along with the unnecessary ones, here is what you can do to get the data back:

  • Download and run Stellar Repair for Outlook that will help you recover and repair .PST files.
  • To begin with MS Outlook pst recovery, Select the appropriate location and the file type.
  • Click on the Scan button so that the software can create a list of the recoverable files.
  • From the list, select the ones you wish to recover and click on the Recover
  • Lastly, finish the process by saving these files.

Conclusion

At the end, we would like to suggest you to try using the Inbox Repair Tool to fix a corrupt .PST file but if it fails to do the job, then you must go with the Stellar Repair for Outlook. They have a demo version for you to check if the software will be able to do what you want it to, which will help you to make the right decision while making an investment in the DIY software.  Stellar a known brand for data care resolutions to customers, delivering data recovery solutions from all kinds of data loss situations.

Leave a Reply

Your email address will not be published. Required fields are marked *