2 Methods to Export All Emails from a Specific Sender to an Excel File

If you would like to quickly export the emails which are from a specific sender to an Excel file, you can use the following 2 means introduced in this article.

For some reasons, such as making a summary, at times, you may need to export the specific emails, such as emails from a specific sender, to an Excel file. When it comes to exporting, the native feature “export’ will occur to most users’ minds in the first place. But to be honest, using Outlook VBA will be much handier than the traditional “Export’ feature. Now we will introduce the two means in detail.

Export All Emails from a Specific Sender to an Excel File

Method 1: Use “Export” Feature

  1. At the very outset, launch your Outlook application.
  2. Then click into the search box in the email list, which will enable the “Search Tools” ribbon.
  3. Click the “From” button in the ribbon.
  4. Then replace the “sender name” character with the specific sender’s name.Search Emails from a Specific Sender
  5. After that, only the emails from the specific sender will show in the list. Now press “Ctrl + A” to select all of them.
  6. Next right click and select “Move” > “Other Folder”.
  7. Subsequently, in the popup “Move Items” dialog box, create a new folder and select this folder to move the specific emails to.Move the specific emails to a new folder
  8. After that, you can go to “File” > “Open” > “Import”.
  9. Then in the following dialog box, select ‘Export to a file” > “Next” > “Microsoft Excel 97 – 2003” > “Next”.
  10. Next choose the specific folder which is storing the emails from the specific sender and hit “Next”.Export Wizard
  11. Then click “browse” to choose an Excel file or create a new Excel file.
  12. Later, click “Next” > “Finish”.
  13. Finally Outlook will work to export. After the export process completes, you can find and open this Excel file.

Method 2: Use Outlook VBA

  1. In the first place, press “Alt + F11” key buttons.
  2. Then in the popup window, open a new module and copy the following codes into it.
Sub ExportEmailsfromSpecificSender()
    Dim objEmails, objSpecificEmails As Outlook.Items
    Dim objItem As Object
    Dim strSpecificSender As String
    Dim strFilter As String
    Dim objExcelApplication As Excel.Application
    Dim objExcelWorkbook As Excel.Workbook
    Dim objExcelWorksheet As Excel.Worksheet
    Dim nRow As Integer
    Dim strFilePath As String
 
    On Error Resume Next
    'Get the emails from a specific sender
    Set objEmails = Application.Session.GetDefaultFolder(olFolderInbox).Items
    strSpecificSender = InputBox("Input the name of the specific sender:", "Specify Sender")
    strFilter = "[From] = '" & strSpecificSender & "'"
    Set objSpecificEmails = objEmails.Restrict(strFilter)
 
    Set objExcelApplication = CreateObject("Excel.Application")
    Set objExcelWorkbook = objExcelApplication.Workbooks.Add
 
    'Export the specific emails to worksheet
    Set objExcelWorksheet = objExcelWorkbook.Worksheets(1)
    With objExcelWorksheet
         .Cells(1, 1) = "Subject"
         .Cells(1, 2) = "Received"
         .Cells(1, 3) = "Body"
         .Cells(1, 4) = "Categories"
         .Cells(1, 5) = "Size"
    End With
 
    nRow = 2
    For Each objItem In objSpecificEmails
        With objExcelWorksheet
             .Name = "From " & strSpecificSender
             .Cells(nRow, 1) = objItem.Subject
             .Cells(nRow, 2) = objItem.ReceivedTime
             .Cells(nRow, 3) = objItem.Body
             .Cells(nRow, 4) = objItem.Categories
             .Cells(nRow, 5) = objItem.Size
        End With
        nRow = nRow + 1
    Next
 
    objExcelWorksheet.Columns("A:E").AutoFit

    'Save the Excel workbook
    strFilePath = "C:\Report\Emails from " & strSpecificSender & ".xlsx"
    objExcelWorkbook.Close True, strFilePath
 
    'Notify you of the export complete
    MsgBox ("Export Complete!")
End Sub

VBA Codes - Export All Emails from a Specific Sender to an Excel File

  1. Subsequently, click the “Run” icon in the toolbar.
  2. After that, you will be required to input the name of the specific sender.Input the name of specific sender
  3. Later, click “OK”.
  4. At once, Outlook will start to export the emails from the specific sender and save the Excel file to the predetermined destination folder.
  5. After exporting completes, you can go to the destination folder to open and check it.

Get Rid of Outlook Issues Flexibly

Due to the fact that Outlook is susceptible to various errors, it’s recommended to keep a potent Outlook fix tool in vicinity, such as DataNumen Outlook Repair. In this case, to solve the small errors, you can simply use the Scanpst.exe. But for the serious troubles, you can resort to the more robust tool.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including damaged SQL Server and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.