I ran across a tweet today from Gillian Vrooman that raised an issue I had never been concerned with: how many members are there in a given Outlook distribution list? Here’s what she said: “Seriously? Why can’t I find a total number of members listed into an #Outlook 2007 personal distribution list? It should be simple”. I agree with Gillian, it should be simple. Unfortunately it isn’t. Outlook does not have a built in means of showing the number of members in the list even though the underlying object has a property MemberCount that keeps count of the number of members.
There are a couple of potential solutions for getting the count. In my opinion the simplest one is to use a macro that displays the count. Here’s what such a macro might look like.
Sub ShowDistListMembershipCount() Const MACRO_NAME = "Dist List Members" Dim olkList As Object Select Case TypeName(Application.ActiveWindow) Case "Explorer" Set olkList = Application.ActiveExplorer.Selection(1) Case "Inspector" Set olkList = Application.ActiveInspector.CurrentItem End Select If TypeName(olkList) = "DistListItem" Then msgbox "There are " & olkList.MemberCount & " member(s) in the list.", vbInformation + vbOKOnly, MACRO_NAME Else msgbox "No distribution list open/selected.", vbCritical + vbOKOnly, MACRO_NAME End If Set olkList = Nothing End Sub
Adding the Code to Outlook. Adding the code to Outlook is simple. Here’s how.
1. Start Outlook
2. Click Tools > Macro > Visual Basic Editor
3. If not already expanded, expand Microsoft Office Outlook Objects
4. If not already expanded, expand Modules
5. Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6. Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook’s VB Editor window
7. Edit the code as needed. I included comments wherever something needs to or can change
8. Click the diskette icon on the toolbar to save the changes
9. Close the VB Editor
Using the Code. The code is simple to use. After opening or selecting a distribution list run the macro. It’ll display a dialog-box that shows the number of members the list is composed of.
I’m going to tweet this solution back to Gillian. I hope she finds it useful. Hopefully you will too.