Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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.

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. Click for 60-day free trial without limitation!
all folders show total number kto 9.00

Kutools for Outlook: 100+ New Advanced Tools for Outlook.
Office Tab: Enable Tabbed Editing and Browsing in Office, Just Like Chrome, Firefox, IE 8/9/10.
Classic Menu: Bring Old Menus and Toolbars Back to Office 2007, 2010, 2013, 2016 and 2019.

arrow blue right bubble 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.


arrow blue right bubble 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.


arrow blue right bubbleRelated Articles

 

Recommended Productivity Tools

shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121

Kutools for Outlook - More than 100 Advanced Functions for Outlook, Improve 70% Efficiency For you

  • Complicated and repeated operations can be done a one-time processing in seconds.
  • Forward multiple emails individually with one-click, and auto forward by rules.
  • Auto CC/BCC every sending email and easy for customizing rules, and auto reply without requiring exchange server.
  • Powerful junk emails filter, remove duplicate emails, reply with attachment, bunch of one-click operations, and so on...
  • 60-day unlimited free trial. 60-day money back guarantee. 2 years free upgrade and support. Buy once, use forever.
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.