VBA Outlook: How to Create a Contact Group

VBA & macros · Updated November 3, 2026

VBA Outlook: How to Create a Contact Group

In classic Outlook for Windows, VBA can create a contact group by making an Outlook DistListItem, adding resolved recipients with AddMembers, and saving it. The macro below creates a new group in the default Contacts folder; it does not create a Microsoft 365 Group or an Exchange distribution list.

How Outlook contact groups work

Outlook’s object model calls a contact group a distribution list. In VBA, the corresponding item type is olDistributionListItem, represented by the DistListItem object. The group is an Outlook contacts item that collects recipient entries under one name, so you can address a message to the group instead of adding each member separately.

A group is not the same thing as a shared or centrally managed mailing list. A contact group saved in your mailbox is generally for your Outlook use. It does not automatically give colleagues access to the list, create a Microsoft 365 Group with shared resources, or update an Exchange address book. If you need an organization-wide list that multiple people can manage, ask your Microsoft 365 or Exchange administrator about the appropriate centrally managed option.

What the VBA macro creates—and what it does not

The macro creates one new distribution-list item and adds the addresses supplied in its code. It does not create a separate contact card for every member. The recipients can be people or addresses Outlook can resolve, such as entries in your Contacts folder or your organization’s address book. How Outlook resolves a name or address depends on the available address books and account configuration.

This example expects Outlook to resolve every address before it saves the group. That check helps prevent a misspelled or unknown entry from silently becoming part of the list. If a valid external address cannot be resolved in your Outlook setup, add it through Outlook’s normal contact-group interface or adjust the workflow to suit your address book and test carefully.

Before you run it

This applies to classic Outlook for Microsoft 365 on Windows, which supports Outlook VBA and the Outlook object model. New Outlook for Windows does not support VBA macros, and Outlook for Mac does not provide this VBA workflow. If you do not see the Visual Basic editor in Windows, confirm that you are using classic Outlook rather than new Outlook.

  • Use a short test list first, especially if the addresses will be used for important or large mailings.
  • Check that the addresses are correct and that Outlook can resolve them in the current profile.
  • Save the macro in Outlook’s VBA project. Macros that change Outlook items cannot be reversed with Ctrl+Z, so keep a backup of relevant Outlook data and delete a test group manually if needed.
  • Follow your organization’s macro-security rules. Do not broadly lower security settings just to run an untrusted macro.

VBA code to create the group

In classic Outlook for Windows, press Alt+F11 to open the VBA editor, choose Insert > Module, and paste in the code. Replace the sample group name and addresses with your own. The entries in the array are examples only; they are not created as contacts by this code.

Sub CreateContactGroup()
    Dim olApp As Outlook.Application
    Dim groupItem As Outlook.DistListItem
    Dim memberMail As Outlook.MailItem
    Dim addresses As Variant
    Dim i As Long

    On Error GoTo HandleError

    Set olApp = Outlook.Application
    Set groupItem = olApp.CreateItem(olDistributionListItem)
    Set memberMail = olApp.CreateItem(olMailItem)

    ' Replace these examples with addresses Outlook can resolve.
    addresses = Array("alex@example.com", "sam@example.com")
    groupItem.DLName = "Project Team"

    ' Build the recipient collection used by AddMembers.
    For i = LBound(addresses) To UBound(addresses)
        memberMail.Recipients.Add CStr(addresses(i))
    Next i

    ' Do not save if any recipient cannot be resolved.
    If Not memberMail.Recipients.ResolveAll Then
        MsgBox "At least one address could not be resolved. Check the list and try again."
        Exit Sub
    End If

    groupItem.AddMembers memberMail.Recipients
    groupItem.Save

    MsgBox "Contact group saved: " & groupItem.DLName
    Exit Sub

HandleError:
    MsgBox "The group was not created: " & Err.Description
End Sub

To run it from the editor, place the cursor inside CreateContactGroup and press F5, or return to Outlook and run it through the Macros command if available under your configuration. The macro makes a new group each time it runs; it does not search for or update an existing group with the same name. Check the Contacts folder afterward and remove any duplicate test groups manually.

What each part of the code does

CreateItem(olDistributionListItem) creates a new distribution-list item in Outlook. Setting DLName gives the group its visible name. The temporary mail item is used only to build a Recipients collection; it is not sent. Each call to Recipients.Add adds an address, and ResolveAll asks Outlook to match the entries to recipients it recognizes.

When all recipients resolve, AddMembers copies them into the distribution list and Save saves it. In this example, saving the new distribution-list item places it in the default Contacts folder for the Outlook profile. If you have multiple accounts, stores, or Contacts folders, verify where the item is saved rather than assuming it is in a particular shared or secondary folder.

The error handler displays an error message for unexpected failures, such as a problem saving the item. A failed resolution also stops the macro before it saves the group. If the macro stops, check the spelling of the entries and confirm the correct Outlook account and address book are available.

Choosing and maintaining the member list

For a short, fixed list, editing the array in the macro is straightforward. For a larger list, hard-coding dozens of addresses is harder to maintain and easier to mistype. You could instead read addresses from a file or another data source, but that adds code to validate the input, handle blanks, and report which entries failed. Keep the resolution check even when changing how the addresses are supplied.

  • Use email addresses when duplicate display names could make recipient selection ambiguous.
  • Use consistent group names so people can distinguish similar lists in Contacts, such as “Project Team – Current.”
  • Review membership periodically when people change roles or leave a project; a saved group does not automatically track changes in a separate spreadsheet or directory.
  • Consider privacy before using a group in an email. A contact group does not hide its members from recipients when placed in the To or Cc field. Use Bcc when appropriate, following your organization’s communication rules.

Common problems and practical checks

“At least one address could not be resolved.” Check for spelling mistakes, extra spaces, obsolete addresses, and names that match more than one entry. An address may be valid in general but not resolvable through the address books available to this Outlook profile. Try resolving it in a new Outlook message first; if Outlook cannot identify it, the macro’s check is likely to stop as designed.

The group does not appear where expected. Look in the Contacts folder associated with the profile and account that ran the macro. A group saved to your default Contacts folder is not necessarily stored in a shared mailbox’s Contacts folder. If the macro must target a specific store or folder, the code needs to select that folder explicitly rather than relying on the default item location.

Running the macro creates duplicates. This sample always creates a fresh item. It does not test whether a group with the same name already exists. Before running it again, check Contacts. For a repeated automation process, add logic to find and update a chosen list, and test that logic on a copy or disposable test group before using it on important data.

The VBA editor or macro will not run. Confirm you are in classic Outlook for Windows and that your organization permits the macro. Macro security is controlled through Outlook’s Trust Center settings; a managed work device may enforce policies that users cannot change. Avoid enabling all macros indiscriminately. A digitally signed macro or an approved administrator-managed approach is safer for ongoing use.

Contact group versus other mailing-list options

Choose a contact group when you need a personal, Outlook-stored collection of recipients for regular messages. Choose an Exchange distribution group or Microsoft 365 Group when the list needs central ownership, shared management, or organization-wide availability. Those services are managed differently and are not created by the DistListItem VBA code shown here.

For a one-time message, adding recipients directly to the message may be simpler than creating a permanent group. For a list that changes regularly, a centrally maintained directory group may avoid the need to keep a local contact group synchronized. The right choice depends on who needs to use and maintain the list, not just how many addresses it contains.

Frequently Asked Questions

Can Outlook VBA create a contact group automatically?
Yes, in classic Outlook for Windows. Create an olDistributionListItem, set its DLName, add a resolved Recipients collection with AddMembers, and save it.

Does this macro create individual contacts too?
No. It adds recipient entries to the group. It does not create separate contact cards in your Contacts folder for the people listed.

Can I use this macro in new Outlook or Outlook for Mac?
No, this VBA approach requires classic Outlook for Windows. New Outlook for Windows and Outlook for Mac do not support this Outlook VBA workflow.

Will the group be available to everyone in my company?
Not automatically. A contact group saved in your Outlook Contacts is not the same as an Exchange distribution group or Microsoft 365 Group. Ask your administrator about a centrally managed list if coworkers need shared access.

Why does Outlook say an address cannot be resolved?
Outlook may not find the address in the address books available to the current profile, or the entry may be misspelled or ambiguous. Confirm it can be resolved in a new message before running the macro again.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.