How to Quickly Create a Contact Group from the Contacts of a Specific Company in Outlook

Many users need to create a contact group from the contacts of a specific company. Thus, this article will expose an intelligent way, which can realize it in an instant.

If you frequently need to send an email to all the contacts of a specific company, it is advisable to directly create a contact group for them. By this means, you won’t need to find out all contacts of the company one by one each time when you need to send an email to them. Now, in the followings, we will teach you how to quickly realize it using VBA.

Quickly Create a Contact Group from the Contacts of a Specific Company

Create a Contact Group from the Contacts of a Specific Company

  1. At the very outset, launch your Outlook application.
  2. Then, in the main Outlook window, press “Alt + F11” key buttons to access VBA editor.
  3. In the subsequent “Microsoft Visual Basic for Applications” screen, you need to open an unused module or just insert a new one.
  4. Next, you could copy the following VBA code into this module as usual.
Sub CreateContactGroupFromContactsOfSpecificCompany()
    Dim objContactsFolder As Folder
    Dim strCompany As String
    Dim objFoundContacts As Outlook.Items
    Dim objContact As Outlook.ContactItem
    Dim objContactGroup As DistListItem
    Dim objTempMail As MailItem
    Set objContactsFolder = Outlook.Application.ActiveExplorer.CurrentFolder
    If objContactsFolder.DefaultItemType = olContactItem Then
       If objContactsFolder.Items.count > 0 Then
          strCompany = InputBox("Input the specific company:", "Specify Company")
          'Get contacts only
          Set objFoundContacts = objContactsFolder.Items.Restrict("[Email1Address]>''")
          'Get the contacts of a specific company
          Set objFoundContacts = objFoundContacts.Restrict("[CompanyName] = '" & strCompany & "'")
          If objFoundContacts.count > 0 Then
             'Create a contact group in current folder
             Set objContactGroup = objContactsFolder.Items.Add("IPM.DistList")
             For Each objContact In objFoundContacts
                 Set objTempMail = Application.CreateItem(olMailItem)
                 objTempMail.Recipients.Add (objContact.Email1Address)
                 'Add the contacts to group
                 With objContactGroup
                      .DLName = strCompany
                      .AddMembers objTempMail.Recipients
                 End With
             MsgBox "There is no contact in this company!", vbExclamation
          End If
          MsgBox "There is no item in this Contacts folder!", vbExclamation
       End If
       MsgBox "Please access a Contacts folder!", vbExclamation
    End If
End Sub

VBA Code - Create a Contact Group from the Contacts of a Specific Company

  1. After that, you can exit the current window.
  2. Later add this new macro to Quick Access Toolbar.
  3. Finally you can try this macro.
  • First off, access a contacts folder.
  • Then hit the macro button in Quick Access Toolbar.
  • Next, you’ll be required to input the name of a specific company, such as “DataNumen, Inc.”Specify Company
  • At once, a new contact group will show up, which will look like the image below:New Contact Group

Keep Prepared for Outlook Crash

Since Outlook is susceptible to errors and crashes, we should keep well-prepared for these issues. For instance, we have to make consistent and up-to-date backup for Outlook data. In this case, even if the original Outlook data gets corrupted, we still can recover Outlook data from backups like a cork. Besides, it is prudent to equip Outlook with a powerful repair tool, like DataNumen Outlook Repair. It will come in handy absolutely.

Author Introduction:

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

Comments are closed.