2 Methods to Get the Count of Outlook Contacts in Each Color Category

If you would like to figure out how many contacts in each category, you can use the 2 methods introduced in this article. One is using instant search and the other is using VBA.

Like using color categories to manage your Outlook emails, you can classify your contacts via categories, too. If you have color categorized your contacts and now you wish to get the total count of contacts in each different category, you can use the following 2 means to achieve it.

Get the Count of Outlook Contacts in Each Color Category

Method 1: Use Instant Search

  1. In the first place, launch your Outlook.
  2. Then open your contacts folder.
  3. Next click into the search box to activate the “Search Tools” ribbon.
  4. Subsequently, click the “Categorized” button.
  5. From its drop down list, you can select one or more color categories. Here we will take “Purple Category” as an example.Search by Color Categories
  6. After selecting the specific category, you will see a related search criterion is filled in the search box.
  7. Now in the left bottom of the status bar, you can check the total count of the contacts in the selected category, like the following image:See the Count in Status Bar

By this means, you have to count the contacts in every category one by one. It will be quite cumbersome. Thus, if you want to get the total count of contacts in each color category in one go, you can recur to the next trick.

Method 2: Use Outlook VBA

  1. At the very outset, press “Alt + F11” key shortcuts in Outlook.
  2. Then you will get access to the Outlook VBA editor window.
  3. Next you need to open a new module or a module which is not in use.
  4. Subsequently, copy and paste the following VBA codes into such a module.
Sub CountContactsinEachCategory()
    Dim objDictionary As Object
    Dim objContactsFolder As Outlook.Folder
    Dim objContacts As Outlook.Items
    Dim objContact As Object
    Dim strCategory As String
    Dim strPrompt As String
    Dim nMessage As Integer

    Set objDictionary = CreateObject("Scripting.Dictionary")
    Set objContactsFolder = Outlook.Application.Session.GetDefaultFolder(olFolderContacts)
    'You can count the contacts in selected Contact folder by....
    'Set objContactsFolder = Outlook.Application.ActiveExplorer.CurrentFolder
    Set objContacts = objContactsFolder.Items
 
    For Each objContact In objContacts
        strCategory = objContact.Categories
        objDictionary(strCategory) = CLng(objDictionary(strCategory)) + 1
    Next objContact
 
    For Each Key In objDictionary.Keys
        strPrompt = strPrompt & Key & ": " & objDictionary(Key) & vbCrLf
    Next
 
    nMessage = MsgBox(strPrompt, vbInformation, "Count Contacts by Color Category")
End Sub

VBA Codes - Get the Count of Outlook Contacts in Each Color Category

  1. After that, ensure that your Outlook allow macros.
  2. Later, you can click the “Run” icon in the toolbar.
  3. Finally, you will get a message showing the number of contacts in each color category, like the image below:Count Outlook Contacts in Each Color Category

Rescue Your Outlook Data

When you encounter such a case that you can access your PST file as normal, it is very likely that the file is corrupted. At this point, in order to get back the corrupt PST data, you have no choice but to take recourse to a potent enough repair 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 mdf fix and outlook repair software products. For more information visit www.datanumen.com

One response to “2 Methods to Get the Count of Outlook Contacts in Each Color Category”

Leave a Reply

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