2 Quick Ways to Export the List of All Flagged Outlook Emails to Excel

If you would like to export the list of all flagged emails from your Outlook mailbox to Excel, you can use either of the 2 methods shared in this article.

For example, so as to deal with all flagged emails more timely or share them with someone else, you may hope to export them to an Excel worksheet. Here we will introduce 2 approaches to realize it. The former one uses standard “Import and Export” feature after finding flagged emails. To be honest, it is a bit tedious. Thus, in the latter one, we will teach you a more convenient way that applies VBA.

Export the List of All Flagged Outlook Emails to Excel

Method 1: Export All Found Flagged Emails Manually

  1. First of all, click in the search box above the mail list.
  2. Then, click “All Mail Items” in “Scope” group on “Search” tab.
  3. Next, click the “Flagged” button in “Define” group.Search Flagged Emails
  4. After all flagged emails shown in the list, select one mail and press “Ctrl + A” to select all of them.
  5. Then, press “Ctrl + Shift + V” key shortcuts.
  6. In the new dialog box, create a new folder under the Outlook file.Create a New Folder
  7. Later, select the new created folder and click “OK”, which will move all found flagged emails to the new folder.Move All Flagged Emails to the New Folder
  8. Afterwards, click “File” > “Open” > “Import”,
  9. In the popup dialog box, choose “Export to a file” > “Next” > “Microsoft Excel 97-2003” > “Next”.Export to a file
  10. In the new screen, select the correct folder and hit “Next”.Select Folder to Export From
  11. Subsequently, follow the wizards to complete “Export”.
  12. You will get a new Excel file, shown as the following screenshot.Exported Excel File

Method 2: Export the List of All Flagged Emails via VBA

  1. In Outlook, press “Alt + F11” to trigger VBA editor.
  2. Then, enable “MS Excel Object” with accordance to “How to Add an Object Library Reference in VBA“.
  3. Next, copy the VBA code below into a module.
Dim objExcelApp As Excel.Application
Dim objExcelWorkbook As Excel.Workbook
Dim objExcelWorksheet As Excel.Worksheet

Sub ExportAllFlaggedEmailsToExcel()
    Dim objOutlookFile As Outlook.Folder
    Dim objFolder As Outlook.Folder
  
    'Select a source PST file
    Set objOutlookFile = Outlook.Application.Session.PickFolder
 
    If Not (objOutlookFile Is Nothing) Then
       'Create a new Excel file
       Set objExcelApp = CreateObject("Excel.Application")
       Set objExcelWorkbook = objExcelApp.Workbooks.Add
       Set objExcelWorksheet = objExcelWorkbook.Sheets("Sheet1")
       objExcelApp.Visible = True
 
       With objExcelWorksheet
           .Cells(1, 1) = "Subject"
           .Cells(1, 1).Font.Bold = True
           .Cells(1, 2) = "Start Date"
           .Cells(1, 2).Font.Bold = True
           .Cells(1, 3) = "Due Date"
           .Cells(1, 3).Font.Bold = True
           .Cells(1, 4) = "From"
           .Cells(1, 4).Font.Bold = True
           .Cells(1, 5) = "To"
           .Cells(1, 5).Font.Bold = True
      End With
 
      For Each objFolder In objOutlookFile.Folders
          If objFolder.DefaultItemType = olMailItem Then
             Call ProcessMailFolders(objFolder)
          End If
      Next
 
      objExcelWorksheet.Columns("A:E").AutoFit

      MsgBox "Completed!", vbInformation + vbOKOnly, "Export Emails"
    End If
End Sub

Sub ProcessMailFolders(ByVal objCurrentFolder As Outlook.Folder)
    Dim i As Long
    Dim objMail As Outlook.MailItem
    Dim objFlaggedMail As Outlook.MailItem
    Dim nLastRow As Integer
    Dim objSubfolder As Outlook.Folder
 
    For i = 1 To objCurrentFolder.Items.Count
        If objCurrentFolder.Items(i).Class = olMail Then
           'Export the information of each flagged email to Excel
           Set objMail = objCurrentFolder.Items(i)
           If objMail.IsMarkedAsTask = True And objMail.FlagStatus <> olFlagComplete Then
              Set objFlaggedMail = objMail
 
              With objExcelWorksheet
                   nLastRow = .Range("A" & .Rows.Count).End(xlUp).Row + 1
                   .Range("A" & nLastRow) = objFlaggedMail.Subject
                   .Range("B" & nLastRow) = objFlaggedMail.TaskStartDate
                   .Range("C" & nLastRow) = objFlaggedMail.TaskDueDate
                   .Range("D" & nLastRow) = objFlaggedMail.SenderName
                   .Range("E" & nLastRow) = objFlaggedMail.To
              End With
          End If
        End If
    Next i
 
    If objCurrentFolder.Folders.Count > 0 Then
       For Each objSubfolder In objCurrentFolder.Folders
           Call ProcessMailFolders(objSubfolder)
       Next
    End If
End Sub

VBA Code - Export the List of All Flagged Emails

  1. Lastly, put cursor in the “ExportAllFlaggedEmailsToExcel” subroutine and hit “F5” key button.
  2. Then, select an Outlook file in the new dialog box.Select Outlook File
  3. When you get “Completed” prompt, you will also get a new Excel file, like the image below.Exported Excel File via VBA

Protect Your Outlook from Corruption

Outlook is prone to errors and corruption, thus it is a very arduous task for us to safeguard our Outlook data. Undoubtedly, the most effectual and practical way is to make regular data backups for Outlook. In addition to it, it is also necessary for us to get hold of a powerful and trustworthy Outlook fix tool, such as DataNumen Outlook Repair. It will come into handy if inbox repair tool makes no effect.

Author Introduction:

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