跳至主要内容

Kutools for Office — 一套工具,五种功能。事半功倍。

如何在Outlook中将所有收件人姓名插入到邮件正文中?

Author: Xiaoyang Last Modified: 2025-08-22

有时,在Outlook中撰写电子邮件时,您可能需要将所有收件人的姓名插入到邮件正文中。当然,您可以逐个将姓名复制并粘贴到正文中。但是,如果有几十个收件人姓名需要粘贴,这将非常繁琐。本文将介绍一种简单的方法来解决这个问题。

使用VBA代码在Outlook中将所有收件人姓名插入到邮件正文


使用VBA代码在Outlook中将所有收件人姓名插入到邮件正文

以下VBA代码可以帮助您将“收件人”字段中的所有姓名插入到邮件正文中,请按照以下步骤操作:

1. 启动Outlook,然后按住 ALT + F11 键打开 Microsoft Visual Basic for Applications 窗口。

2. 单击 插入 > 模块,并将以下代码粘贴到模块窗口中。

VBA代码:将收件人姓名插入邮件正文:

Sub InsertRecipientNamesToBody()
Dim xMailItem As Outlook.MailItem
Dim xRecipient As Outlook.Recipient
Dim xRecipAddress, xRecipNames, xRecipName, xFilterAddr As String
Dim xItems As Outlook.Items
Dim i As Integer
Dim xFoundContact As Outlook.ContactItem
Dim xDoc As Word.Document
On Error Resume Next
Set xMailItem = Outlook.ActiveInspector.CurrentItem
xMailItem.Recipients.ResolveAll
For Each xRecipient In xMailItem.Recipients
    xRecipAddress = xRecipient.Address
    Set xItems = Application.Session.GetDefaultFolder(olFolderContacts).Items
    For i = 1 To 3
        xFilterAddr = "[Email" & i & "Address] = " & xRecipAddress
        Set xFoundContact = xItems.Find(xFilterAddr)
        If Not (xFoundContact Is Nothing) Then
           xRecipNames = xRecipNames & xFoundContact.FullName & Chr(10)
           Exit For
        End If
    Next
    If (xFoundContact Is Nothing) Then
       xRecipName = Split(xRecipAddress, "@")(0)
       xRecipNames = xRecipNames & xRecipName & Chr(10)
    End If
Next
Set xDoc = xMailItem.GetInspector.WordEditor
xDoc.Content.InsertAfter xRecipNames
Set xMailItem = Nothing
Set xRecipient = Nothing
Set xItems = Nothing
Set xFoundContact = Nothing
End Sub

3. 接下来仍然在 Microsoft Visual Basic for Applications 窗口中,单击 工具 > 引用 以打开“引用 - Project1”对话框,并从“可用的引用”列表框中勾选 Microsoft Word Object Library 选项,见截图:

the screenshot of step about inserting all recipient names to email body in outlook 1

4. 然后单击 确定 关闭对话框,现在,您应该将此代码添加到快速访问工具栏中。

5. 单击 新建邮件 创建新邮件,在邮件窗口中,点击 自定义快速访问工具栏 图标,并选择 更多命令,见截图:

the screenshot of step about inserting all recipient names to email body in outlook 2

6. 在 Outlook 选项 对话框中:

(1.) 从“选择命令来自”下拉列表中选择

(2.) 然后选择刚刚插入的VBA代码名称;

(3.) 单击 添加 按钮将代码添加到“自定义快速访问工具栏”列表框中。

the screenshot of step about inserting all recipient names to email body in outlook 3

7. 接下来,一个宏图标会显示在快速访问工具栏中,如下图所示:

the screenshot of step about inserting all recipient names to email body in outlook 4

8. 现在,当您单击该宏图标时,“收件人”字段中的姓名将被插入到邮件正文中,如下图所示:

the screenshot of step about inserting all recipient names to email body in outlook 5

最佳 Office 办公效率工具

最新消息:Kutools for Outlook 推出免费版!

体验全新 Kutools for Outlook,超过100 种强大功能!立即点击下载!

🤖 Kutools AI 采用先进的 AI 技术,轻松处理邮件,包括答复、总结、优化、扩展、翻译和撰写邮件。

📧 邮箱自动化自动答复(支持 POP 和 IMAP) /计划发送邮件 /发送邮件时按规则自动抄送密送 / 自动转发(高级规则) / 自动添加问候语 / 自动将多收件人的邮件分割为单独邮件 ...

📨 邮件管理撤回邮件 / 按主题及其他条件阻止欺诈邮件 / 删除重复邮件 / 高级搜索 / 整合文件夹 ...

📁 附件增强批量保存 / 批量拆离 / 批量压缩 / 自动保存 / 自动拆离 / 自动压缩 ...

🌟 界面魔法😊更多美观酷炫的表情 /重要邮件到达时提醒 / 最小化 Outlook 而非关闭 ...

👍 一键高效操作带附件全部答复 / 防钓鱼邮件 / 🕘显示发件人时区 ...

👩🏼‍🤝‍👩🏻 联系人与日历批量添加选中邮件中的联系人 / 分割联系人组为单独的组 / 移除生日提醒 ...

可根据您偏好选择 Kutools 使用语言——支持英语、西班牙语、德语、法语、中文及40 多种其他语言!

只需点击一下即可立即激活 Kutools for Outlook。无需等待,立即下载,提升工作效率!

kutools for outlook features1 kutools for outlook features2

🚀 一键下载——获取所有 Office 插件

强烈推荐:Kutools for Office(五合一)

一键下载五个安装包Kutools for Excel、Outlook、Word、PowerPoint以及 Office Tab Pro 立即点击下载!

  • 一键便利操作:一次下载全部五个安装包。
  • 🚀 随时满足 Office任务需求:需要哪个插件随时安装即可。
  • 🧰 包含:Kutools for Excel / Kutools for Outlook / Kutools for Word / Office Tab Pro / Kutools for PowerPoint