How to Batch Open All the Unread Emails in Your Outlook via VBA

If you would like to open all the unread emails in bulk, you can utilize the method introduced in this article. It is using VBA to find and display all the unread mails in one go.

So as to better classify and manage a great amount of mails in your Outlook, you must have created various custom folders and subfolders. Also, perhaps you have enabled many rules to auto move the incoming emails to different folders. In this case, most of time, you’ll find that many new unread emails arrive in the different folders. That is to say, you have to switch to multiple folders to find and view the unread emails. Therefore, you may feel it tedious. Without any doubts, it couldn’t be better if there are any ways to enable users to display all unread emails in one go. Now, in the followings, we will expose such a means to you.

Batch Open All the Unread Emails in Your Outlook

Batch Open All the Unread Emails in Your Outlook

  1. In the first place, you should start your Outlook application.
  2. Then press “Alt + F11” keys to access Outlook VBA editor.
  3. Next in the new popup window, you need to open a new module.
  4. Subsequently, copy and paste the following VBA code into the module.
Sub OpenAllUnreadEmails()
    Dim objFolders As Outlook.Folders
    Dim objFolder As Outlook.Folder
    Dim lUnreadMailCount As Long
    lUnreadMailCount = 0
    'Change "John Smith" to the name of your own Outlook file
    Set objFolders = Outlook.Application.Session.Folders("John Smith").Folders
    For Each objFolder In objFolders
        Call ProcessFolders(objFolder, lUnreadMailCount)
    MsgBox "Open " & lUnreadMailCount & " unread emails successfully!", vbExclamation + vbOKOnly, "Batch Open Unread Mails"
End Sub

Sub ProcessFolders(ByVal objCurrentFolder As Outlook.Folder, lCurUnreadEmailCount As Long)
    Dim objItem As Object
    Dim objMail As Outlook.MailItem
    Dim objSubfolder As Outlook.Folder
    'Display Unread Emails only
    If objCurrentFolder.DefaultItemType = olMailItem Then
       For Each objItem In objCurrentFolder.Items
           If TypeOf objItem Is MailItem Then
              Set objMail = objItem
              If objMail.UnRead = True Then
                 lCurUnreadEmailCount = lCurUnreadEmailCount + 1
              End If
           End If
    End If
    If objCurrentFolder.Folders.Count > 0 Then
       For Each objSubfolder In objCurrentFolder.Folders
           Call ProcessFolders(objSubfolder, lCurUnreadEmailCount)
    End If
End Sub

VBA Code - Batch Open All the Unread Emails in Your Outlook

  1. After that, you need to ensure that your Outlook allows the macros.
  2. Finally you can have a try. Directly click the “run” icon in the toolbar or press F5 key to trigger the subroutine.
  3. At once, all the unread emails in the predefined Outlook file will be opened in their own Message window.
  4. And you will get a message like the following screenshot:Prompt Unread Emails Opened

Settle Frequent Outlook Problems

If you frequently suffer a variety of issues in your Outlook, you should keep alert in that it may refer to some omens of Outlook corruption. Once Outlook crashes, it is very likely that your Outlook file will be in danger. Hence, in order to prevent painful Outlook data loss, you need to back up your Outlook PST file on a regular basis, which will help a lot in future Outlook data recovery.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf recovery and outlook repair software products. For more information visit

Leave a Reply

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