How to count the number of flagged messages in Outlook?
In outlook, you can flag the messages, contacts or tasks for making them outstanding, but, sometimes, you need to count the number of flagged items in your Outlook. How could you deal with this task in Outlook?
Count the number of flagged messages in one account with Search Folders
Count the number of flagged messages / contacts / tasks separately in all accounts with VBA code
Count the number of flagged messages in one account with Search Folders
To count the number of flagged emails in an account of Outlook, the Search Folders feature can help you, please do as this:
1. Right click Search Folders under your Email account, and then select New Search Folder, see screenshot:
2. Then a New Search Folder dialog box is popped out, click Mail flagged for follow up option in the Reading Mail section, see screenshot:
3. Then click OK, and all flagged messages are copied into the For Follow Up folder, and the total number of the flagged emails is displayed as following screenshot shown:
Count the number of flagged messages / contacts / tasks separately in all accounts with VBA code
If you want to count the number of all flagged items, such as emails, contacts and tasks in Outlook separately, 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. Then, click Insert > Module, copy and paste below code into the opened blank module, see screenshot:
VBA code: Count the number of flagged times in Outlook:
Dim GSeparateCount, GMailCount, GContactCount, GTaskCount As Long
Sub CountFlaggedItems()
Dim xStore As Outlook.Store
Dim xTotalCount As Long
Dim xPrompt As String
Dim xFolder As Folder
Dim i, k As Integer
On Error Resume Next
xTotalCount = 0
GMailCount = 0
GContactCount = 0
GTaskCount = 0
For Each xStore In Application.Session.Stores
For Each xFolder In xStore.GetRootFolder.Folders
Call ProcessFolders(xFolder)
Next
Next
xTotalCount = GMailCount + GContactCount + GTaskCount
xPrompt = xTotalCount & " items have been flagged, as follows: " & Chr(10) & Chr(10) & "Emails: " & GMailCount & Chr(10) & "Contacts: " & GContactCount & Chr(10) & "Tasks: " & GTaskCount
MsgBox xPrompt, vbInformation + vbOKOnly, "Kutools for Outlook"
End Sub
Sub ProcessFolders(ByVal CurFolder As Outlook.Folder)
Dim xSubfolder As Outlook.Folder
Dim xItem As Object
Dim i, k As Integer
On Error Resume Next
For i = CurFolder.Items.Count To 1 Step -1
Set xItem = CurFolder.Items.item(i)
Select Case xItem.Class
Case olMail, olPost, olSharing
If xItem.IsMarkedAsTask = True Then
GMailCount = GMailCount + 1
End If
Case olContact, olDistList
If xItem.IsMarkedAsTask = True Then
GContactCount = GContactCount + 1
End If
Case olTask
If CurFolder.DefaultItemType = olTaskItem Then
GTaskCount = GTaskCount + 1
End If
End Select
Next i
If CurFolder.Folders.Count > 0 Then
For k = CurFolder.Folders.Count To 1 Step -1
Set xSubfolder = CurFolder.Folders.item(k)
Call ProcessFolders(xSubfolder)
Next k
End If
End Sub
3. Then press F5 key to run this code, and a prompt box is popped out to tell you the total count of all flagged items as below screenshot shown:
Count the number of today, yesterday, read, unread, total items...in Outlook
With Kutools for Outlook's powerful Statistics feature, you can get the number of itmes based on date, selected items, read, unread and so on as you need. Kutools for Outlook: with more than 100+ handy Excel add-ins, free to try with no limitation in 60 days. Download and try the free trial now!
|
Best Office Productivity Tools
Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook
✔ Email Automation: Auto Reply (Out of Office) / Schedule Send emails / Auto CC/BCC / Advanced Auto Forward / Auto Add Greating ...
✉ Email Management: Easily Recall Emails / Block Scam Emails / Delete Duplicate Emails / 🔎Advanced Search / Consolidate Folders ...
📁 Attachments Pro: Batch Save / Batch Detach / Batch Compress / Auto Save / Auto Detach / Auto Compress ...
🌟 Interface & Interaction Magic: 😊More Pretty and Cool Emojis / Brings Browser Tabs Right Into Your Outlook / Minimize Outlook Instead of Closing ...
👍 One-click Wonders: Reply All with Incoming Attachments / Anti-Phishing Emails / 🕘Show Sender's Time Zone / Send to Recipients Separately ...
👩🏼🤝👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails / Split a Contact Group to Individual Groups / Remove Birthday Reminders ...
Over 100 Features Await Your Exploration! Click Here to Discover More.