Skip to main content

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 Microsoft Office, Making Work a Breeze
Kutools for Outlook - Boost Outlook with 100+ Advanced Features for Superior Efficiency
Boost your Outlook 2021 - 2010 or Outlook 365 with these advanced features. Enjoy a comprehensive 60-day free trial and elevate your email experience!

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.


Best Office Productivity Tools

Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook

🤖 AI Mail Assistant: Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...

📧 Email Automation: Out of Office (Available for POP and IMAP)  /  Schedule Send Emails  /  Auto CC/BCC by Rules When Sending Email  /  Auto Forward (Advanced Rules)   /  Auto Add Greeting   /  Automatically Split Multi-Recipient Emails into Individual Messages ...

📨 Email Management: Easily Recall Emails  /  Block Scam Emails by Subjects and Others  /  Delete Duplicate Emails  /  Advanced Search  /  Consolidate Folders ...

📁 Attachments ProBatch Save  /  Batch Detach  /  Batch Compress  /  Auto Save   /  Auto Detach  /  Auto Compress ...

🌟 Interface Magic: 😊More Pretty and Cool Emojis   /  Boost Your Outlook Productivity with Tabbed Views  /  Minimize Outlook Instead of Closing ...

👍 One-click Wonders: Reply All with Incoming Attachments  /   Anti-Phishing Emails  /  🕘Show Sender's Time Zone ...

👩🏼‍🤝‍👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails  /  Split a Contact Group to Individual Groups  /  Remove Birthday Reminders ...

Over 100 Features Await Your Exploration! Click Here to Discover More.

Read More       Free Download      Purchase
 

 

Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
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!
This comment was minimized by the moderator on the site
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
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations