Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to mark unread emails older than specific days as read automatically in Outlook?

If there are multiple unread emails in your Inbox folder, normally, you can apply the Mark All as Read feature to mark all unread emails as read emails manually. But, have you ever tried to mark unread emails which are older than specific days as read automatically in Outlook without setting it manually each time?

Mark unread emails older than specific days as read automatically with VBA code


Mark unread emails older than specific days as read automatically with VBA code

To auto mark all unread emails older than specific days as read, the following VBA code can do you a favor:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, double click ThisOutlookSession from the Project1(VbaProject.OTM) pane to open the mode, and then copy and paste the below code into the blank module.

VBA code: Auto mark unread emails older than specific days as read:

Private Sub Application_Startup()
        Call MarkOldUnreadEmailsAsRead
    End Sub
    Private Sub MarkOldUnreadEmailsAsRead()
    Dim xInboxFld As Outlook.Folder
    Dim xAccount As Account
    On Error GoTo L1
    For Each xAccount In Outlook.Application.Session.Accounts
        Set xInboxFld = xAccount.DeliveryStore.GetDefaultFolder(olFolderInbox)
        Call Processfolders(xInboxFld)
    Next xAccount
L1:     Exit Sub
    End Sub
    Private Sub Processfolders(ByVal InboxFld As Outlook.Folder)
    Dim xItems As Outlook.Items
    Dim i As Long
    Dim xSubFld As Outlook.Folder
    On Error Resume Next
    Set xItems = InboxFld.Items
    For i = 1 To xItems.Count
        If DateDiff("d", xItems(i).ReceivedTime, Now) >= 15 Then
           If xItems(i).UnRead = True Then
              xItems(i).UnRead = False
              xItems(i).Save
           End If
        End If
    Next
    If InboxFld.Folders.Count > 0 Then
       For Each xSubFld In InboxFld.Folders
           Call Processfolders(xSubFld)
       Next
    End If
End Sub

Note: In the above code, you can change the number of days within this script: If DateDiff("d", xItems(i).ReceivedTime, Now) >= 15 Then to your own needed.

3. Then save and close this code window, since then, every time when you launch Outlook, all unread emails which are older than predefined days will be marked as read automatically at once.

Note: This code is only available to the default data account.


Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.