跳到主要内容

如何在 Outlook 中为主题创建下拉列表?

您可能有不同的预设电子邮件主题需要分发给 Outlook 中的不同收件人。 在撰写电子邮件时使用主题行下拉列表来选择主题而无需手动输入会非常有效。 就像下面展示的 gif 一样。 本教程提供了三个 VBA 代码来帮助您创建具有不同预设主题的下拉列表。 撰写电子邮件时,您可以从下拉列表中选择您需要的任何主题以自动填写主题行。 请按照分步指南完成操作。


使用 VBA 代码为 Outlook 中的主题创建下拉列表

实际上,Outlook 不允许在主题行中添加下拉列表。 在这里,您需要创建一个用户表单并将其与 VBA 代码结合以完成它。

1.启动Outlook,按 其他 + F11 键打开 Microsoft Visual Basic应用程序 窗口。

2.在 Microsoft Visual Basic应用程序 窗口中,单击 插页 > 用户表格.

3.然后 用户表单1 插入在 Project1 在左侧窗格中 Visual Basic中 编辑。 您需要通过拖动 组合框命令按钮 分别从 工具箱用户表单1.

4.右键单击命令按钮并选择 查看房源 在右键菜单中。

5.在 属性 - 命令按钮 1 窗格,更改 标题 字段 OK. 此操作将更改命令按钮上显示的文本。

6.双击UserForm中的空白区域,打开对应的 用户窗体(代码) 窗口,然后将现有代码替换为以下 VBA 代码。

VBA 代码 1:带有包含多个预设电子邮件主题的下拉列表的用户窗体

Private Sub UserForm_Initialize()
'Updated by Extendoffice 20220927
  With ComboBox1
    .AddItem "Subject 1"
    .AddItem "Subject 2"
    .AddItem "Subject 3"
    .AddItem "Subject 4"
    .AddItem "Subject 5"
    .AddItem "No change"
  End With
End Sub

Private Sub CommandButton1_Click()
  GCbbIndex = ComboBox1.ListIndex
  GSelSubject = ComboBox1.Value
  Unload Me
End Sub

备注:在代码中, 主题 1、2、3、45 是您要在电子邮件中使用的预设电子邮件主题。 “没有变化” 表示不更改现有电子邮件主题的任何内容。 您可以根据需要更改 VBA 代码中预设的电子邮件主题。

7.双击 Project1 > Microsoft Outlook对象 > 本次展望会议. 然后将以下 VBA 代码复制到 ThisOutlookSession (Code) 窗口中。

ThisOutlookSession 窗口中使用的 VBA 代码 2

Public WithEvents GExplorer As Explorer
'Updated by Extendoffice 20220927
Private Sub Application_Startup()
  Set GExplorer = Application.ActiveExplorer
End Sub

Private Sub GExplorer_InlineResponse(ByVal Item As Object)
  Set GInlineMail = Item
End Sub

8.继续点击 插页 > 模块 ,在 Visual Basic中 编辑。 然后将以下 VBA 代码复制并粘贴到 模块(代码) 窗口。

模块窗口中使用的 VBA 代码 3

Public GCbbIndex As Long
'Updated by Extendoffice 20220927
Public GSelSubject As String
Public GInlineMail As MailItem
Public Sub ChangeSubject()
  Dim xItem As MailItem
  Dim xMail As Outlook.MailItem
  On Error Resume Next
  Select Case TypeName(Application.ActiveWindow)
    Case "Explorer"
      Set xMail = GInlineMail
      Debug.Print "Explorer"
    Case "Inspector"
      Set xMail = Application.ActiveInspector.CurrentItem
      Debug.Print "Inspector"
  End Select
  UserForm1.Show
  If (GCbbIndex <> -1) And (GSelSubject <> "no change") Then
    xMail.Subject = GSelSubject
  End If
End Sub

9. 保存代码并按 其他 + Q 关闭键 Visual Basic 编辑器 窗口并返回 Outlook 应用程序。

10。 点击 新邮件 按钮下 主页 选项卡以创建电子邮件。

11. 在新消息窗口中,单击 自定义快速访问工具栏 > 更多命令.

12.在 Outlook选项 对话框,您需要配置如下。

12.1)选择 ,在 从中选择命令 下拉列表;
12.2)选择 项目1.更改主题 在命令列表框中;
12.3)点击 地址 按钮;
12.4)点击 OK 按钮。 看截图:

13.然后你可以看到一个按钮 已添加到消息窗口的功能区。

14. 现在您需要重新启动 Outlook。

15. 在撰写邮件时,如果需要插入预设主题,只需点击功能区上新增的按钮以显示用户表单,从下拉菜单中选择一个主题,然后单击 OK 按钮将其填充到主题行中。

:

1)您可以用下拉列表中选择的任何主题更改现有主题;
2) 此方法在新窗口回复或转发邮件时效果很好;
3) 如果您倾向于从阅读窗格中在线回复电子邮件,而不是打开单独的窗口,您可以按如下方式调出用户表单。
3.1)点击 开发商 > > 项目1.更改主题。 看截图:

3.2) 弹出用户表单时,从下拉列表中选择一个预设主题,点击 OK 按钮,原来的主题将立即改变。

4) 如果您选择 没有变化 在下拉菜单中,将保留原主题,不做任何更改。

最佳办公生产力工具

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

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

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

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

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

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

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

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

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

了解更多       免费下载      购买
 

 

Comments (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Would it be possible to create an external source for:
.AddItem "Subject 1"
.AddItem "Subject 2"
.AddItem "Subject 3"
.AddItem "Subject 4"
.AddItem "Subject 5"

So the list can be shared and edited for multiple computers?
This comment was minimized by the moderator on the site
Hi,

I have made the procedure but when i clic on the macro button, they don't have any action ?
Could you help me ?
This comment was minimized by the moderator on the site
Hi,

Sorry for the inconvenience. Did you follow the instructions provided in the post exactly? Can you tell me which version of Excel you are using?
This comment was minimized by the moderator on the site
I would like to creat an E-mail draft with such a drop down list for the subject.
Is it possible to attache this function to an mail template or does it have to be installed in the software of each user?
This comment was minimized by the moderator on the site
Hi Hana,

The code can't be attached to an email template, users who need to use this dropdown list will need to follow the steps in the tutorial to add the code to their Outlook.
This comment was minimized by the moderator on the site
Hi,

This is great. Is it possible to do the same for Outlook Calendar invites...meetings and appointments?
This comment was minimized by the moderator on the site
Hi James Marr,

This method does not support Outlook Calendar at the moment. Sorry for the inconvenience.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations