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

Kutools for Outlook: 100+ New Advanced Tools for Outlook.
Office Tab: Enable Tabbed Editing and Browsing in Office, Just Like Chrome, Firefox, IE 8/9/10.
Classic Menu: Bring Old Menus and Toolbars Back to Office 2007, 2010, 2013, 2016 and 2019.

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.

 

Recommended Productivity Tools

shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121

Kutools for Outlook - More than 100 Advanced Functions for Outlook, Improve 70% Efficiency For you

  • Complicated and repeated operations can be done a one-time processing in seconds.
  • Forward multiple emails individually with one-click, and auto forward by rules.
  • Auto CC/BCC every sending email and easy for customizing rules, and auto reply without requiring exchange server.
  • Powerful junk emails filter, remove duplicate emails, reply with attachment, bunch of one-click operations, and so on...
  • 60-day unlimited free trial. 60-day money back guarantee. 2 years free upgrade and support. Buy once, use forever.
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 · 1 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 · 4 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