Skip to main content

How to export and print list of all folders and subfolders in Outlook?

Generally speaking, you can press Ctrl + 6 keys to view the list of all folders on Navigation Pane in Outlook. However, you can not print the list of folders. This article will introduce two VBA scripts to export and print the list of all folders and their subfolders in Outlook.


Export and print the list of all Outlook folders and their subfolders in new email

This method will introduce a VBA to export the list of all folders and their subfolders in a specified email account into a new email in Outlook, and then you can print the list of folders easily.

1. Press Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and then paste below VBA code into the new Module window.

VBA: Export the list of folders and subfolders in a new email in Outlook

Public gFolders As String

Public Sub GetFolderNames()
Dim oSession As Outlook.NameSpace
Dim oFolder As Outlook.MAPIFolder
Dim oNewMail As Outlook.mailItem

Set oSession = Outlook.Application.GetNamespace("MAPI")
Set oFolder = oSession.PickFolder

If (oFolder Is Nothing) Then Exit Sub

ProcessFolder oFolder

Set oNewMail = Application.CreateItem(olMailItem)
oNewMail.Body = gFolders
oNewMail.Display

gFolders = ""
End Sub

Sub ProcessFolder(CurrentFolder As Outlook.MAPIFolder)

Dim i As Long
Dim oSubFolder As Outlook.MAPIFolder
Dim oFolder As Outlook.MAPIFolder
Dim sFolderPaths As String

    For i = CurrentFolder.Folders.Count To 1 Step -1
Set oFolder = CurrentFolder.Folders(i)

sFolderPaths = oFolder.FolderPath
gFolders = gFolders & vbCrLf & sFolderPaths & " " & oFolder.Items.Count
Next

For Each oSubFolder In CurrentFolder.Folders
If oSubFolder.Name <> "Deleted Items" Then
ProcessFolder oSubFolder
End If

Next

End Sub

3. Press F5 key to run this VBA.

4. In the popping out Select Folder dialog box, please select the email account whose list of folders you want to print, and click the OK button. See screenshot:

5. And now the folder list of the specified email account is copied to a new email as below screenshot shown. Please click File > Print to print the copied list of folders.

6. After printing, please close the new email without saving.


Export and print the list of all Outlook folders ant there subfolders in Notepad

This method will introduce a VBA to export the list of all folders and their subfolders in a specified email account from Outlook to Notepad, and then you can print the list of Outlook folders in the Notepad easily.

1. Press Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and then paste below VBA code into the new Module window.

VBA: Export the list of all Outlook folders and subfolders from Outlook to Notepad

Dim gFileName, gCreateTree, gBase

Public Sub ExportFolderTree()
Dim objOutlook
Dim F, Folders
Dim Result

  Set objOutlook = CreateObject("Outlook.Application")

  Set F = objOutlook.Session.PickFolder

If Not F Is Nothing Then
Set Folders = F.Folders

    Result = MsgBox("Do you want to create tree?", vbYesNo + vbDefaultButton2 + vbApplicationModal, "Output Folder Tree")
If Result = 6 Then
gCreateTree = True
Else
gCreateTree = False
End If

    gFileName = GetDesktopFolder() & "\Outlook-Folders.txt"
gBase = Len(F.FolderPath) - Len(Replace(F.FolderPath, "\", "")) + 1

    WriteToATextFile (CreateFolderTree(F.FolderPath, F.Name))

LoopFolders Folders

Set F = Nothing
Set Folders = Nothing
Set objOutlook = Nothing
End If
End Sub

Private Function GetDesktopFolder()
Dim objShell
Set objShell = CreateObject("WScript.Shell")
GetDesktopFolder = objShell.SpecialFolders("Desktop")
Set objShell = Nothing
End Function

Private Sub LoopFolders(Folders)
Dim F

For Each F In Folders
WriteToATextFile (CreateFolderTree(F.FolderPath, F.Name))
LoopFolders F.Folders
Next
End Sub

Private Sub WriteToATextFile(OLKfoldername)
Dim objFSO, objTextFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(gFileName, 8, True)
objTextFile.WriteLine (OLKfoldername)
objTextFile.Close
Set objFSO = Nothing
Set objTextFile = Nothing
End Sub

Private Function CreateFolderTree(OLKfolderpath, OLKfoldername)
If gCreateTree = False Then
CreateFolderTree = Mid(OLKfolderpath, 3)
Else
Dim i, x, OLKprefix
i = Len(OLKfolderpath) - Len(Replace(OLKfolderpath, "\", ""))

    For x = gBase To i
OLKprefix = OLKprefix & "-"
Next

CreateFolderTree = OLKprefix & OLKfoldername
End If
End Function

3. Press F5 key to run this VBA. Next in the opening Select Folder dialog box, please select the email account whose folder list you want to export and print, and click the OK button. See screenshot:

4. Then Output Folder Tree dialog box is coming. Please click the Yes button or No button as you need.

And now a Text file named as Outlook-Folders is created and saved on your desktop as below screenshot shown.

5. Double click to open the new text file, and then click File > Print to print the exported list of outlook folders.

One click to show total numbers of items in all folders on the Navigation Pane in Outlook

Normally, Outlook shows the numbers of unread items in each folder on the Navigation Pane. But, Kutools for Outlook’s All Folders Show Total Number of Items feature can help you show the total numbers of items in all folders with only one click.


all folders show total number kto 9.00

Related Articles


Best Office Productivity Tools

Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook

🤖 AI Mail Assistant: Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...

📧 Email Automation: Out of Office (Available for POP and IMAP)  /  Schedule Send Emails  /  Auto CC/BCC by Rules When Sending Email  /  Auto Forward (Advanced Rules)   /  Auto Add Greeting   /  Automatically Split Multi-Recipient Emails into Individual Messages ...

📨 Email Management: Easily Recall Emails  /  Block Scam Emails by Subjects and Others  /  Delete Duplicate Emails  /  Advanced Search  /  Consolidate Folders ...

📁 Attachments ProBatch Save  /  Batch Detach  /  Batch Compress  /  Auto Save   /  Auto Detach  /  Auto Compress ...

🌟 Interface Magic: 😊More Pretty and Cool Emojis   /  Boost Your Outlook Productivity with Tabbed Views  /  Minimize Outlook Instead of Closing ...

👍 One-click Wonders: Reply All with Incoming Attachments  /   Anti-Phishing Emails  /  🕘Show Sender's Time Zone ...

👩🏼‍🤝‍👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails  /  Split a Contact Group to Individual Groups  /  Remove Birthday Reminders ...

Over 100 Features Await Your Exploration! Click Here to Discover More.

Read More       Free Download      Purchase
 

 

Comments (3)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Thank you so much for this very valuable post. It really helped me a lot as outlook is still not able to show the folder structure!
This comment was minimized by the moderator on the site
Saved us a ton of time. Thanks for the detailed instructions. Worked like a charm! :)
Rated 5 out of 5
This comment was minimized by the moderator on the site
Most excellent tip. Thank you!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations