跳到主要內容

如何在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 for Applications 按下 其他 + 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 for Applications 窗口。

將宏的按鈕添加到快速訪問工具欄

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