How to Batch Mark All Emails as Read in All Outlook Folders with VBA

Multiple users long for a solution to batch mark all emails as read in all Outlook folders. In this article, we will introduce such a method to you.  

As we all know, it is easy to mark all mails in a folder as read. Just select and right click on the folder and then choose “Mark all as read” option in the context menu. However, if there are several folders having unread emails, by the above means, you have to perform on the folders one by one. It is too troublesome. Hence, here we will share you a much more efficient way, which will allow you to realize it in bulk.

Batch Mark All Emails as Read in All Outlook Folders

  1. To start with, launch Outlook application.
  2. Then, press “Alt + F11” to access Outlook VBA editor.
  3. Next, in the “Microsoft Visual Basic for Applications” window, copy the code below into an unused module.
Sub MarkAllItemsAsRead()
    Dim objStores As Outlook.Stores
    Dim objStore As Outlook.Store
    Dim objOutlookFile As Outlook.Folder
    Dim objFolder As Outlook.Folder
    'Process all Outlook files
    Set objStores = Outlook.Application.Session.Stores
    For Each objStore In objStores
        Set objOutlookFile = objStore.GetRootFolder
        For Each objFolder In objOutlookFile.Folders
            'Process mail folders
            If objFolder.DefaultItemType = olMailItem Then
               Call ProcessFolders(objFolder)
            End If
End Sub

Sub ProcessFolders(ByVal objCurFolder As Outlook.Folder)
    Dim objUnreadItems As Outlook.Items
    Dim i As Integer
    Dim objItem As Object
    Dim objSubFolder As Outlook.Folder
    Set objUnreadItems = objCurFolder.Items.Restrict("[Unread]=True")
    'Mark all unread emails as read
    For i = 1 To objUnreadItems.Count
        Set objItem = objUnreadItems.Item(i)
        objItem.UnRead = False
    'Process subfolders recursively
    If objCurFolder.Folders.Count > 0 Then
       For Each objSubFolder In objCurFolder.Folders
           Call ProcessFolders(objSubFolder)
    End If
End Sub

VBA Code - Batch Mark All Emails as Read in All Outlook Folders

  1. Afterwards, put cursor into the first subroutine.
  2. Subsequently, press “F5” key button or click the “Run” icon in the toolbar.
  3. Eventually, after macro completes, you can go back to mail folder list.
  4. There, you’ll see that all unread emails have been marked as read, as shown in the screenshot.All Emails Have Been Read

Escape from Miserable Outlook Data Loss

Users may have accepted a fact that Word documents and Excel workbooks can be corrupt easily. As a matter of fact, similar to these files, Outlook data file is also prone to damage. Hence, if you are reluctant to experience that, you ought to take some actions. It should include precautions, like regular backups and blocking all malware or viruses, and some relief measures, like knowing how to launch inbox repair tool, Scanpst and keeping a powerful external fix 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 repair mdf and outlook repair software products. For more information visit

2 responses to “How to Batch Mark All Emails as Read in All Outlook Folders with VBA”

  1. objUnreadItems is updating as items are marked read, so we need to start from the bottom of the stack and work up.
    ‘Mark all unread emails as read
    For i = 1 To objUnreadItems.Count

    ‘Mark all unread emails as read
    For i = objUnreadItems.Count To 1 Step -1

  2. Hello, it’s nice but keep gives error (Run Time error ‘214735267) (80020009)
    Set objItem = objUnreadItems.Item(i)

Leave a Reply

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