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
- To begin with, access VBA editor in Outlook by referring to “How to Run VBA Code in Your Outlook“.
- 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" Else Exit Do End If Loop objItem.SaveAs strFilePath, olMSG Next Next 'Open the Windows folder Call Shell("explorer.exe " & strWindowsFolder, vbNormalFocus) End If End Sub
- Then, click the “Run” icon in the toolbar.
- Next, in the pop-up dialog box, select a destination Windows folder and click “OK”.
- When macro finishes, the Windows folder will be displayed.
- In this Windows folder, the folders and its items in “Favorites” section have been exported, like the following screenshot.
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 www.datanumen.com
Leave a Reply