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.
Method 1: Use Instant Search
- In the first place, launch your Outlook.
- Then open your contacts folder.
- Next click into the search box to activate the “Search Tools” ribbon.
- Subsequently, click the “Categorized” button.
- From its drop down list, you can select one or more color categories. Here we will take “Purple Category” as an example.
- After selecting the specific category, you will see a related search criterion is filled in the search box.
- 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:
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
- At the very outset, press “Alt + F11” key shortcuts in Outlook.
- Then you will get access to the Outlook VBA editor window.
- Next you need to open a new module or a module which is not in use.
- 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
- After that, ensure that your Outlook allow macros.
- Later, you can click the “Run” icon in the toolbar.
- Finally, you will get a message showing the number of contacts in each color category, like the image below:
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.
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