How to export emails from multiple folders/subfolders to excel in Outlook?
Exporting emails from multiple folders or subfolders to Excel can be a tedious task if you're relying on manual methods or limited Outlook features. Thankfully, there are more efficient ways to achieve this. In this article, weโll explore two methods: a VBA-based approach and a faster, user-friendly solution with Kutools for Outlook. While the VBA method offers flexibility, it involves complex setup and adjustments. In contrast, Kutools for Outlook provides a straightforward and powerful way to export emails to Excel with just a few clicks, saving you time and effort. Let's dive into the details.
Export Emails from Multiple Folders/Subfolders to Excel Using VBA (Complex but Flexible)
Export Emails from a Folder/Subfolder to Excel Using Kutools for Outlook ๐ (Efficient and User-Friendly)
Export Emails from Multiple Folders/Subfolders to Excel Using VBA
If you're comfortable with coding and need a customizable solution, using VBA can be effective. This method allows you to specify multiple folders or subfolders and export their emails to separate Excel files. However, it requires technical knowledge and careful customization of the code.
Step 1: Open the VBA Editor
Press Alt + F11 to launch the "Microsoft Visual Basic for Applications" window.
Step 2: Insert a New Module
Click "Insert" > "Module", and then paste the below VBA code into the new Module window.
VBA: Export emails from multiple folders and subfolders to Excel
Const MACRO_NAME = "Export Outlook Folders to Excel"
Sub ExportMain()
ExportToExcel "destination_folder_path\A.xlsx", "your_email_account\folder\subfolder_1"
ExportToExcel "destination_folder_path\B.xlsx", "your_email_account\folder\subfolder_2"
MsgBox "Process complete.", vbInformation + vbOKOnly, MACRO_NAME
End Sub
Sub ExportToExcel(strFilename As String, strFolderPath As String)
Dim olkMsg As Object
Dim olkFld As Object
Dim excApp As Object
Dim excWkb As Object
Dim excWks As Object
Dim intRow As Integer
Dim intVersion As Integer
If strFilename <> "" Then
If strFolderPath <> "" Then
Set olkFld = OpenOutlookFolder(strFolderPath)
If TypeName(olkFld) <> "Nothing" Then
intVersion = GetOutlookVersion()
Set excApp = CreateObject("Excel.Application")
Set excWkb = excApp.Workbooks.Add()
Set excWks = excWkb.ActiveSheet
With excWks
.Cells(1, 1) = "Subject"
.Cells(1, 2) = "Received"
.Cells(1, 3) = "Sender"
End With
intRow = 2
For Each olkMsg In olkFld.Items
If olkMsg.Class = olMail Then
excWks.Cells(intRow, 1) = olkMsg.Subject
excWks.Cells(intRow, 2) = olkMsg.ReceivedTime
excWks.Cells(intRow, 3) = GetSMTPAddress(olkMsg, intVersion)
intRow = intRow + 1
End If
Next
Set olkMsg = Nothing
excWkb.SaveAs strFilename
excWkb.Close
Else
MsgBox "The folder '" & strFolderPath & "' does not exist in Outlook.", vbCritical + vbOKOnly, MACRO_NAME
End If
Else
MsgBox "The folder path was empty.", vbCritical + vbOKOnly, MACRO_NAME
End If
Else
MsgBox "The filename was empty.", vbCritical + vbOKOnly, MACRO_NAME
End If
Set olkMsg = Nothing
Set olkFld = Nothing
Set excWks = Nothing
Set excWkb = Nothing
Set excApp = Nothing
End Sub
Public Function OpenOutlookFolder(strFolderPath As String) As Outlook.MAPIFolder
Dim arrFolders As Variant
Dim varFolder As Variant
Dim bolBeyondRoot As Boolean
On Error Resume Next
If strFolderPath = "" Then
Set OpenOutlookFolder = Nothing
Else
Do While Left(strFolderPath, 1) = "\"
strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
Loop
arrFolders = Split(strFolderPath, "\")
For Each varFolder In arrFolders
Select Case bolBeyondRoot
Case False
Set OpenOutlookFolder = Outlook.Session.Folders(varFolder)
bolBeyondRoot = True
Case True
Set OpenOutlookFolder = OpenOutlookFolder.Folders(varFolder)
End Select
If Err.Number <> 0 Then
Set OpenOutlookFolder = Nothing
Exit For
End If
Next
End If
On Error GoTo 0
End Function
Function GetSMTPAddress(Item As Outlook.MailItem, intOutlookVersion As Integer) As String
Dim olkSnd As Outlook.AddressEntry
Dim olkEnt As Object
On Error Resume Next
Select Case intOutlookVersion
Case Is < 14
If Item.SenderEmailType = "EX" Then
GetSMTPAddress = SMTPEX(Item)
Else
GetSMTPAddress = Item.SenderEmailAddress
End If
Case Else
Set olkSnd = Item.Sender
If olkSnd.AddressEntryUserType = olExchangeUserAddressEntry Then
Set olkEnt = olkSnd.GetExchangeUser
GetSMTPAddress = olkEnt.PrimarySmtpAddress
Else
GetSMTPAddress = Item.SenderEmailAddress
End If
End Select
On Error GoTo 0
Set olkSnd = Nothing
Set olkEnt = Nothing
End Function
Function GetOutlookVersion() As Integer
Dim arrVer As Variant
arrVer = Split(Outlook.Version, ".")
GetOutlookVersion = arrVer(0)
End Function
Function SMTPEX(olkMsg As Outlook.MailItem) As String
Dim olkPA As Outlook.propertyAccessor
On Error Resume Next
Set olkPA = olkMsg.propertyAccessor
SMTPEX = olkPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x5D01001E")
On Error GoTo 0
Set olkPA = Nothing
End Function
Step 3: Customize the VBA Code
- Replace "destination_folder_path" in the above code with the actual folder path, such as "C:\Users\DT168\Documents\TEST".
- Replace "your_email_account\folder\subfolder_1" and "your_email_account\folder\subfolder_2" with your Outlook folder paths, such as "Kelly@extendoffice.com\Inbox\A" and "Kelly@extendoffice.com\Inbox\B".
Step 4: Run the Code
Press "F5" or click the "Run" button to execute the code. Then click the "OK" button in the popping "Export Outlook Folders to Excel" dialog box. Now emails from all specified folders/subfolders are exported into Excel workbooks.
Drawbacks:
- Complex Setup: Requires careful code adjustments and a working knowledge of VBA.
- Error-Prone: Small mistakes in customization can lead to errors or incomplete exports.
- Time-Consuming: Not suitable for quick or frequent exports.
Transform Your Email Management with Bulk Processing!
Tired of repetitive email tasks? Kutools for Outlook offers "Bulk Processing" tools to streamline your workflow and save precious time.
- ๐ Reply to Multiple Emails: Send bulk replies using templates without breaking a sweat.
- ๐ง Forward Individually: Forward multiple emails as regular messages, not as attachments.
- ๐ Save as Various Formats: Export emails as PDF, Word, Excel, and moreโall in one go!

Export Emails from a Folder/Subfolder to Excel Using Kutools for Outlook ๐
For a faster and hassle-free approach, "Kutools for Outlook" offers a "Save Selected Emails as Files in Various Formats" feature. This method is highly recommended for its simplicity, speed, and versatility. Whether you're managing a small batch of emails or large datasets, Kutools ensures a seamless experience with minimal effort.
Unlock ultimate email efficiency with Kutools for Outlook! Access 70 powerful features absolutely free, forever. Download the Free Version Now!
Step 1: Select the Folder or Subfolder
Navigate to the folder or subfolder containing the emails you want to export. Press Ctrl + A to select all emails in the list.
Step 2: Access the Save Selected Emails as Files in Various Formats Feature
Click "Kutools" > "Bulk Processing" > "Save Selected Emails as Files in Various Formats".
Step 3: Configure the Export Settings
- In the "Save Messages as Other Files" dialog, choose the destination folder where you want to save the files.
- Select the "Excel format" option.
- Choose the specific email contents to export (e.g., header, body) in the "Save Content" section.
Step 4: Complete the Export
Click "OK" to begin the export process. Once completed, youโll find all emails saved as separate Excel files in the designated folder.
Advantages:
- Fast and Intuitive: Export emails to Excel with just a few clicksโno technical skills required.
- Customizable Output: Choose specific file formats and contents to meet your needs.
- Error-Free Process: Avoid the complexities and potential errors associated with VBA methods.
- Professional Results: Perfect for creating organized records or sharing data efficiently.
Best Office Productivity Tools
Breaking News: Kutools for Outlook Launches Free Version!
Experience the all-new Kutools for Outlook with 100+ incredible features! Click to download now!
๐ค Kutools AI : Uses advanced AI technology to handle emails effortlessly, including replying, summarizing, optimizing, extending, translating, and composing emails.
๐ง Email Automation: Auto Reply (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: Recall Emails / Block Scam Emails by Subjects and Others / Delete Duplicate Emails / Advanced Search / Consolidate Folders ...
๐ Attachments Pro: Batch Save / Batch Detach / Batch Compress / Auto Save / Auto Detach / Auto Compress ...
๐ Interface Magic: ๐More Pretty and Cool Emojis / Remind you when important emails come / Minimize Outlook Instead of Closing ...
๐ One-click Wonders: Reply All with 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 ...
Use Kutools in your preferred language โ supports English, Spanish, German, French, Chinese, and 40+ others!

