How to Quickly Group Outlook Contacts by Domain in List View

Outlook doesn’t offer “Domain” field by default. Therefore, if you hope to group your contacts by domain, you have to first create such a field. Now, this article will show you how to achieve it in an instant.

You can group your Outlook contacts by any available fields, like company, color categories, job title and so on. However, there isn’t a default “Domain” field. Thus, you cannot easily group your contacts by domain. But via the following way, you still can realize it in quick time.

Quickly Group Outlook Contacts by Domain in List View

Group Outlook Contacts by Domain in List View

  1. At the very beginning, start your Outlook program.
  2. Then, in the Outlook window, switch to “Developer” tab and click the “Visual Basic” button.
  3. Next, you will get access to Outlook VBA editor, in which you’ll be required to open an unused module.
  4. Subsequently, copy the following VBA code into this module.
Sub DisplayDomain()
    Dim objCurrentFolder As Outlook.Folder
    Dim objItem As Object
    Dim objContact As Outlook.ContactItem
    Dim objProperties As Outlook.UserProperties
    Dim objProperty As Outlook.UserProperty
    Dim strPropertyName As String
    Dim strMainEmailAddress, strDomain As String
 
    Set objCurrentFolder = Outlook.Application.ActiveExplorer.CurrentFolder
 
    If objCurrentFolder.DefaultItemType = olContactItem Then
       If objCurrentFolder.Items.count > 0 Then
 
          For Each objItem In objCurrentFolder.Items
              If TypeOf objItem Is ContactItem Then
 
                 Set objContact = objItem
                 Set objProperties = objContact.UserProperties
  
                 strPropertyName = "Domain"
 
                 Set objProperty = objProperties.Find(strPropertyName, True)
                 If objProperty Is Nothing Then
                    Set objProperty = objProperties.Add(strPropertyName, olText, True)
                 End If
 
                 strMainEmailAddress = objContact.Email1Address
                 strDomain = Right(strMainEmailAddress, Len(strMainEmailAddress) - InStr(1, strMainEmailAddress, "@"))
 
                 objProperty.value = strDomain
                 objContact.Save
              End If
          Next
       Else
          MsgBox "No Items in This Contacts Folder!", vbExclamation
       End If
    Else
      MsgBox "Please access a Contacts folder!", vbExclamation
    End If
End Sub

VBA Code - Create Domain Field

  1. After that, for later convenient access, you had better add this macro to Quick Access Toolbar. Exit the VBA editor and go to “Outlook Options” to do it.
  2. Ultimately, you can try it.
  • First off, access a Contacts folder.
  • Then change the view to “List”.
  • Next click on the macro button in Quick Access Toolbar.
  • After that, access “View” tab and hit “View Settings” button.
  • In the new dialog box, click on the “Group By” button.
  • Then, in the subsequent “Group By” dialog box, follow the steps shown in the screenshot below:Group Items by Domain
  1. Finally, after you return to the contact list, you will see that the contacts are being grouped by domain, like the picture below:Contacts Grouped by Domain

Keep a Cogent PST Repair Tool Nearby

As a regular Outlook user, you may have ever encountered many issues, including sudden not responding, automatic restart, popup error messages and so on. Thus, it is recommended to get hold of a formidable and dependable Outlook fix utility, like DataNumen Outlook Repair. It is able to fix Outlook issues without breaking a sweat.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including fix mdf and outlook repair software products. For more information visit www.datanumen.com

2 responses to “How to Quickly Group Outlook Contacts by Domain in List View”

Leave a Reply

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