Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to count distribution list members in Outlook?

In Outlook, there’s no feature for you to count the distribution list members directly. If you have a distribution list with large amount of email addresses, how to find out that how many members are included in this group? With this article, you will learn how to count distribution list members with using VBA code.

Count distribution list members in Outlook with VBA code

Create and save a VBA code

Add a button for the macro to the Quick Access Toolbar

Run the VBA code

Office Tab - Enable Tabbed Editing and Browsing in Office, and Make Work Much Easier...
Kutools for Outlook - Brings 100 Powerful Advanced Features to Microsoft Outlook
  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by rules; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails at once; Auto Add Greeting when reply; Auto Add Date&Time into subject...
  • Attachment Tools: Auto Detach, Compress All, Rename All, Auto Save All... Quick Report, Count Selected Mails, Remove Duplicate Mails and Contacts...
  • More than 100 advanced features will solve most of your problems in Outlook 2010-2019 and 365. Full features 60-day free trial.

arrow blue right bubbleCount distribution list members in Outlook with VBA code

You can use VBA code to count the distribution list members as follows.

Create and save a VBA code

1. Open the Microsoft Visual Basic for Applications window with pressing the Alt + F11 keys on the keyboard at the same time.

2. Click Insert > Module. See screenshot:

3. Then copy and paste the following VBA code into the VbaProject window.

VBA: Count distribution list members in Outlook

Sub CountDLMembers()
    Dim oOL As Outlook.Application
    Dim oSelection As Outlook.Selection
    Dim oItem As Object
    Dim olDL As Outlook.DistListItem
    Dim Result As String
    Set oOL = Outlook.Application
    'Check and get the selected Contact Group
    Select Case TypeName(oOL.ActiveWindow)
        Case "Explorer"
            Set oSelection = oOL.ActiveExplorer.Selection
            If oSelection.Count > 0 Then
                Set oItem = oSelection.Item(1)
            Else
                Result = MsgBox("No item selected. " & _
                            "Please select a Contact Group first.", _
                            vbCritical, "CountDLMembers")
                Exit Sub
            End If
        Case "Inspector"
            Set oItem = oOL.ActiveInspector.CurrentItem
        Case Else
            Result = MsgBox("Unsupported Window type." & _
                        vbNewLine & "Please make a selection" & _
                        "in the Calendar or open a Contact Group first.", _
                        vbCritical, "CountDLMembers")
            Exit Sub
    End Select
    If oItem.Class = Outlook.olDistributionList Then
        'Display the member count
        Set olDL = oItem        
        Result = MsgBox("The Contact Group '" & olDL.DLName & "' contains " & olDL.MemberCount & " members.", vbInformation, "CountDLMembers")
    Else
        'Selected item isn't a Contact Group item
        Result = MsgBox("No Contact Group item selected. " & _
                    "Please make a selection first.", _
                    vbCritical, "CountDLMembers")
        Exit Sub
    End If
    'Cleanup
    Set oOL = Nothing
    Set olDL = Nothing
End Sub

4. Then click the Save button to save it.

5. Close the Microsoft Visual Basic for Applications window.

Add a button for the macro to the Quick Access Toolbar

1. Go to the Contacts or People view by clicking the Contacts or People in the Navigation Pane.

2. In Outlook 2010 and 2013, please right click on the Quick Access Toolbar and then click Customize Quick Access Toolbar in the right-clicking menu. See screenshot:

Note: In Outlook 2007, please open a distribution list, and then right click on the Quick Access Toolbar to select the Quick Access Toolbar in the right-clicking menu.

3. In the Outlook Options dialog box, you need to:

1). Make sure that you are locating in the Quick Access Toolbar section;

2). Select Macros in the Choose commands from drop-down list;

3). Select the macros in the Separator box;

4). Click the Add button;

5). And finally click the OK button. See screenshot:

4. Then you can see the button for the macro is added on the Quick Access Toolbar.

Run the VBA code

After adding the button for the macro on the Quick Access Toolbar, now you can run the VBA code to count the distribution list members.

1. In Outlook 2010 and 2013, you can just select a distribution list, and then click the button for the macro on the Quick Access Toolbar.

Note: In Outlook 2007, you need to open a distribution list and then click the button for the macro on the Quick Access Toolbar.

2. Then a prompt box will pop up to tell you how many members are contained in this distribution list. Then click the OK.


Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    albert_tf · 2 years ago
    Wish there was an easier way to find out how many addresses in a contact group, but since there isn't this is about the best method I've seen. Thank you!
  • To post as a guest, your comment is unpublished.
    willie x. gluck · 5 years ago
    Alternate method is to:
    create a dummy message with the list
    expand the list
    select all
    copy to Word
    find and replace: "; " with "^p" [or anything!]
    dialog box shows number of replacements
    add 1 to that number