How to Quickly Get the Total Count of Subfolders under a Specific Folder in Outlook

Maybe you’ve created a great number of subfolders under a certain folder, such as Inbox, in your Outlook. In this case, if you want to count the subfolders, you must be reluctant to counting manually. Here we will share you a far smarter way.

Quickly Get the Total Count of Subfolders under a Specific Folder in Outlook

To better classify and archive items in Outlook, many users are accustomed to creating various folders and subfolders. Yet, afterwards, they may think it a little bit difficult to manage too many folders. In this case, they may want to count how many subfolders there are under a specific folder. Without any doubts, it is stupid and tedious to count manually. Therefore, in the followings, we will show a much more intelligent means.

Get the Total Count of Subfolders under a Specific Folder

  1. At the very outset, start your Outlook program.
  2. Then, in the Outlook window, you can press “Alt + F11” key buttons to access VBA editor.
  3. Next, in the subsequently popup window, you need to open a module that is not being used.
  4. Subsequently, copy and paste the following VBA code into this module.
Sub CountSubfoldersUnderRootFolder()
    Dim objRootFolder As Folder
    Dim lFolderCount As Long
    Dim objFolder As Object
    'Get the current folder
    Set objRootFolder = Outlook.Application.ActiveExplorer.CurrentFolder
    'If you want to select, use the following line instead
    'Set objRootFolder = Outlook.Application.Session.PickFolder
    If objRootFolder.Folders.count > 0 Then
       For Each objFolder In objRootFolder.Folders
           'Exclude the hidden folders under Inbox
           If objFolder.Name <> "Conversation Action Settings" And objFolder.Name <> "Quick Step Settings" Then
              lFolderCount = lFolderCount + 1
              'Process subfolders recursively
              Call ProcessFolders(objFolder, lFolderCount)
           End If
       MsgBox lFolderCount & " subfolders under " & Chr(34) & objRootFolder.Name & Chr(34) & ".", vbInformation
       MsgBox "No subfolders under " & Chr(34) & objRootFolder.Name & Chr(34) & ".", vbInformation
    End If
End Sub
Sub ProcessFolders(objCurrentFolder As Object, lCount As Long)
    Dim objSubfolder As Object
    lCount = lCount + objCurrentFolder.Folders.count
    For Each objSubfolder In objCurrentFolder.Folders
        Call ProcessFolders(objSubfolder, lCount)
End Sub

VBA Code - Get the Total Count of Subfolders under a Specific Folder

  1. After that, you can exit the current window.
  2. Later, go to “File” > “Options” > “Quick Access Toolbar”. There you can add the new macro to Quick Access Toolbar.
  3. Finally, you can try this macro.
  • First off, select a folder whose subfolders you would like to count.
  • Then, click the macro button in Quick Access Toolbar.Run Macro
  • Immediately, Outlook will run this macro.
  • After the macro finishes, you will get a message, like the following image:Message Prompting Total Count of Subfolders

Tricks Coping with Outlook Corruption

Outlook is blazing vulnerable to a plenty of factors, including viruses, software or hardware issues, power outage and so on. No one can guarantee that they’re able to keep their Outlook file far away from corruption. Hence, it’s essential to master some tricks coping with damage. Firstly, you have to make regular PST backup. In addition, you should know how to utilize Scanpst, the inbuilt repair tool. Last but not least, you ought to prepare a more robust external tool, such as DataNumen Outlook repair.

Author Introduction:

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

Leave a Reply

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