跳到主要內容

如何在 Outlook 中為主題創建下拉列表?

您可能有不同的預設電子郵件主題需要分發給 Outlook 中的不同收件人。 在撰寫電子郵件時使用主題行下拉列表來選擇主題而無需手動輸入會非常有效。 就像下面展示的 gif 一樣。 本教程提供了三個 VBA 代碼來幫助您創建具有不同預設主題的下拉列表。 撰寫電子郵件時,您可以從下拉列表中選擇您需要的任何主題以自動填寫主題行。 請按照分步指南完成操作。


使用 VBA 代碼為 Outlook 中的主題創建下拉列表

實際上,Outlook 不允許在主題行中添加下拉列表。 在這裡,您需要創建一個用戶表單並將其與 VBA 代碼結合以完成它。

1.啟動Outlook,按 其他 + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

2。 在裡面 Microsoft Visual Basic for Applications 窗口中,單擊 插入 > 用戶窗體.

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