If you would like to get the number of the appointments that are linked to a specific contact, you can use either of the 2 means introduced in this article.
Outlook allows users to link appointments to contacts. If you have linked many appointments to a specific contact and later want to count them, you must dislike counting them one by one. Therefore, in the followings, we will introduce 2 ways to you. You can choose ether to your liking.
Method 1: Count in Contact “Activities”
- At first, double click the specific contact to open it in its own window.
- Then, click the “Activities” in the “Show” group.
- Next, in the new page, move cursor to header of the activity list.
- Subsequently, right click and choose “View Settings” from the context menu.
- Afterwards, in the popup dialog box, click “Group By” button.
- Later, in another dialog, select “Message Class” in the “Group items by” drop down list.
- Ultimately, click a series of “OK” to apply the view settings.
- When you return to the list, you can see a group called “IPM.Appointment” with a total count of all the appointments linked to the current macro, shown as the following screenshot.
Method 2: Count with Outlook VBA
- To begin with, access Outlook VBA editor via “Alt + F11”.
- Then, copy the following VBA code into a module.
Dim objContact As ContactItem Sub CountAppointmentsLinkedToContact() Dim objStore As Store Dim objOutlookFile As Folder Dim lTotalCount As Long 'Get the contact Set objContact = Outlook.Application.ActiveExplorer.Selection.Item(1) lTotalCount = 0 For Each objStore In Application.Session.Stores Set objOutlookFile = objStore.GetRootFolder Call ProcessFolders(objOutlookFile.Folders, lTotalCount) Next 'Prompt you If lTotalCount > 0 Then MsgBox lTotalCount & " appointments are linked to " & objContact.FullName & ".", vbInformation + vbOKOnly Else MsgBox "No appointment is linked to " & objContact.FullName & ".", vbExclamation + vbOKOnly End If End Sub Sub ProcessFolders(ByVal objFolders As Folders, lCount As Long) Dim objFolder As Folder Dim objItem As Object 'Process all folders recursively For Each objFolder In objFolders For Each objItem In objFolder.Items If TypeOf objItem Is AppointmentItem Then If objItem.Links.Count > 0 Then i = 0 Do Until i = objItem.Links.Count i = i + 1 If objItem.Links(i).Name = objContact.FullName Then lCount = lCount + 1 Exit Do End If Loop End If End If Next If objFolder.Folders.Count > 0 Then Call ProcessFolders(objFolder.Folders, lCount) End If Next End Sub
- Later, add this macro to Quick Access Toolbar (QAT) by following the steps in “How to Run VBA Code in Your Outlook“.
- Finally, you can try it.
- First off, select a contact.
- Then, hit the macro button in QAT.
- When macro finishes, you will receive a message about the count of appointments linked to the selected contact, like the picture below.
When Encountering Frequent Outlook Issues
Assuming that you always come across a variety of problems in your Outlook, you should raise your vigilance. It is very likely that your Outlook PST file tends to be corrupted. At this point, you’d make an updated backup of your Outlook data file at once. Also, if possible, it is recommended to get hold of a powerful PST 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 recover sql and outlook repair software products. For more information visit www.datanumen.com
Leave a Reply