跳到主要内容

如何在Outlook中计算通讯组列表成员?

在Outlook中,没有功能可直接计算通讯组列表成员。 如果您的通讯组列表中包含大量电子邮件地址,如何确定该组中包含多少个成员? 通过本文,您将学习如何使用VBA代码对通讯组列表成员进行计数。

使用VBA代码对Outlook中的通讯组列表成员进行计数

创建并保存VBA代码

将宏的按钮添加到快速访问工具栏

运行VBA代码

Office 选项卡 - 在 Microsoft Office 中启用选项卡式编辑和浏览,让工作变得轻而易举
Kutools for Outlook - 通过 100 多个高级功能增强 Outlook,实现卓越效率
使用这些高级功能增强您的 Outlook 2021 - 2010 或 Outlook 365。 享受全面的 60 天免费试用并提升您的电子邮件体验!

箭头蓝色右气泡使用VBA代码对Outlook中的通讯组列表成员进行计数

您可以使用VBA代码对通讯组列表成员进行计数,如下所示。

创建并保存VBA代码

1。 打开 Microsoft Visual Basic应用程序 按下 其他 + F11 同时按下键盘上的按键。

2。 点击 插页 > 模块。 看截图:

3.然后将以下VBA代码复制并粘贴到 Vba项目 窗口。

VBA:计算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.然后点击 保存 按钮来保存它。

5.关闭 Microsoft Visual Basic应用程序 窗口。

将宏的按钮添加到快速访问工具栏

1。 去 联系我们 or 员工 通过单击查看 联系我们 or 员工 ,在 导航窗格.

2.在Outlook 2010和2013中,请右键单击 快速访问工具栏 依次 自定义快速访问工具栏 在右键菜单中。 看截图:

备注:在Outlook 2007中,请打开一个通讯组列表,然后右键单击 快速访问工具栏 选择 快速访问工具栏 在右键菜单中。

3.在 Outlook选项 对话框,您需要:

1)。 确保您位于 快速访问工具栏 部分;

2)。 选择 ,在 从中选择命令 下拉列表;

3)。 在中选择宏 分隔器 框;

4)。 点击 地址 按钮;

5)。 最后点击 OK 按钮。 看截图:

4.然后,您可以看到该宏的按钮已添加到 快速访问工具栏.

运行VBA代码

在快速访问工具栏上为宏添加按钮之后,现在您可以运行VBA代码以对通讯组列表成员进行计数。

1.在Outlook 2010和2013中,您只需选择一个通讯组列表,然后在Q上单击该宏的按钮uick访问工具栏.

备注:在Outlook 2007中,您需要打开一个通讯组列表,然后在 快速访问工具栏.

2.然后将弹出一个提示框,告诉您此分发列表中包含多少个成员。 然后点击 OK.


最佳办公生产力工具

Kutools for Outlook - 超过 100 种强大功能可增强您的 Outlook

🤖 人工智能邮件助手: 具有人工智能魔力的即时专业电子邮件——一键天才回复、完美语气、多语言掌握。轻松改变电子邮件! ...

📧 电子邮件自动化: 外出(适用于 POP 和 IMAP)  /  安排发送电子邮件  /  发送电子邮件时按规则自动抄送/密件抄送  /  自动转发(高级规则)   /  自动添加问候语   /  自动将多收件人电子邮件拆分为单独的消息 ...

📨 电子邮件管理: 轻松回忆电子邮件  /  按主题和其他人阻止诈骗电子邮件  /  删除重复的电子邮件  /  高级搜索  /  合并文件夹 ...

📁 附件专业版批量保存  /  批量分离  /  批量压缩  /  自动保存   /  自动分离  /  自动压缩 ...

🌟 界面魔法: 😊更多又漂亮又酷的表情符号   /  使用选项卡式视图提高 Outlook 工作效率  /  最小化 Outlook 而不是关闭 ...

👍 一键奇迹: 使用传入附件回复全部  /   反网络钓鱼电子邮件  /  🕘显示发件人的时区 ...

👩🏼‍🤝‍👩🏻 通讯录和日历: 从选定的电子邮件中批量添加联系人  /  将联系人组拆分为各个组  /  删除生日提醒 ...

超过 100特点 等待您的探索! 单击此处了解更多。

了解更多       免费下载      购买
 

 

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