How to Quickly Export All Outlook Folders & Items in “Favorites” Section to a Windows Folder

If you would like to export all Outlook folders as well as its items in “Favorites” section, you can refer to this article. Here we will show you how to accomplish it in quick time.

Generally, the folders and its items in “Favorites” Section are of great importance and frequently needed. Therefore, at times, you may want to export them to the local drive. In the standard way, you have to create Windows folders as per the folders in “Favorites” and save items as MSG files one by one in local drive. That is too tedious. Hence, here we’ll expose a far more efficient way. Now read on to get it.

Export All Folders & Items in “Favorites” Section to a Windows Folder

  1. To begin with, access VBA editor in Outlook by referring to “How to Run VBA Code in Your Outlook“.
  2. Then, copy the following code into an empty module.
Sub ExportAllFoldersItems_InFavorites_ToWindowsFolder()
    Dim objShell As Object
    Dim objWindowsFolder As Object
    Dim objFileSystem As Object
    Dim strWindowsFolder As String
    Dim objNavigationPane As Outlook.NavigationPane
    Dim objNavigationModule As Outlook.NavigationModule
    Dim objNavigationGroup As Outlook.NavigationGroup
    Dim objNavigationFolder As Outlook.NavigationFolder
    Dim objFolder As Outlook.Folder
    Dim strFolderPath As String
    Dim objItem As Object
    Dim strFilePath As String
    Dim i As Long
    'Select a Windows folder
    Set objShell = CreateObject("Shell.Application")
    Set objWindowsFolder = objShell.BrowseForFolder(0, "Select a Windows Folder:", 0, "")
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    If Not objWindowsFolder Is Nothing Then
       strWindowsFolder = objWindowsFolder.self.Path & "\"
       'Get "Favorites" section
       Set objNavigationPane = Application.ActiveExplorer.NavigationPane
       Set objNavigationModule = objNavigationPane.Modules.GetNavigationModule(olModuleMail)
       Set objNavigationGroup = objNavigationModule.NavigationGroups.GetDefaultNavigationGroup(olFavoriteFoldersGroup)
       'Export the folders and items in "Favorites" section
       For Each objNavigationFolder In objNavigationGroup.NavigationFolders
           Set objFolder = objNavigationFolder.Folder
           strFolderPath = strWindowsFolder & objFolder.Name
           objFileSystem.CreateFolder strFolderPath
           For Each objItem In objFolder.Items
               strSubject = objItem.Subject
               strFileName = strSubject & ".msg"
               i = 0
               Do Until False
                  strFilePath = strFolderPath & "\" & strFileName
                  If objFileSystem.FileExists(strFilePath) Then
                     i = i + 1
                     strFileName = strSubject & " (" & i & ").msg"
                     Exit Do
                  End If
               objItem.SaveAs strFilePath, olMSG
       'Open the Windows folder
       Call Shell("explorer.exe " & strWindowsFolder, vbNormalFocus)
    End If
End Sub

VBA Code - Export All Folders & Items in "Favorites" Section to a Windows Folder

  1. Then, click the “Run” icon in the toolbar.
  2. Next, in the pop-up dialog box, select a destination Windows folder and click “OK”.Select Destination Windows Folder
  3. When macro finishes, the Windows folder will be displayed.
  4. In this Windows folder, the folders and its items in “Favorites” section have been exported, like the following screenshot.Exported Folders & Items

Restore Outlook Data from Backups

It is highly suggested to back up Outlook files on a regular basis. It is because that if you suffer Outlook file corruption, you can recover Outlook data from backups easily. But, if you have no such a backup, you have to attempt arduous Outlook fix. At that time, inbox repair tool will not be a lot of help. You have to take aid of fix 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 corrupted sql and outlook repair software products. For more information visit

2 responses to “How to Quickly Export All Outlook Folders & Items in “Favorites” Section to a Windows Folder”

  1. I tried to run this macro but it failed with “the operation failed error” at this line
    objItem.SaveAs strFilePath, olMSG


Leave a Reply

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