如何在 Outlook 中為多個電子郵件帳戶設定不同簽名,以便在回覆或轉寄郵件時自動套用?
根據教學:Outlook 中的電子郵件簽名,您應已掌握如何在 Outlook 中建立簽名。然而,建立新簽名後,若要在回覆或轉寄郵件時使用該簽名,必須手動選取簽名已建立的簽名。
當然,您也可以透過點選簽名 > 簽名,為特定電子郵件帳戶設定簽名,讓 Outlook 在回覆或轉寄郵件時自動加入簽名(如下圖所示)。

然而,若您擁有許多電子郵件帳戶,並希望批次為多個帳戶設定不同簽名,該怎麼辦?本教學將介紹一種 VBA 方法,協助您輕鬆完成這項工作。
在 Outlook 中回覆或轉寄時為多個電子郵件帳戶設定不同簽名
1. 在 Outlook 中,按下 Alt+F11 鍵,即可開啟 Microsoft Visual Basic for Applications 視窗!
2. 在 Microsoft Visual Basic for Applications 視窗中,於專案窗格雙擊 ThisOutlookSession,並將下方 VBA 程式碼貼上至 ThisOutlookSession (程式碼) 視窗中。請參閱截圖:

VBA 程式碼:在 Outlook 中建立新建郵件時為多個電子郵件帳戶設定不同簽名 —— ThisOutlookSession
Public WithEvents GInspectors As Inspectors
Public WithEvents GExplorer As Explorer
Private Sub Application_Startup()
Set GInspectors = Application.Inspectors
Set GExplorer = Application.ActiveExplorer
End Sub
Private Sub GExplorer_InlineResponse(ByVal Item As Object)
‘Update by ExtendOffice
Dim xMail As MailItem
On Error Resume Next
EndTimer
If Item.Class = olMail Then
Set xMail = Item
Set GInspector = Nothing
Set GInspector = xMail.GetInspector
StartTimer
End If
End Sub
Private Sub GInspectors_NewInspector(ByVal Inspector As Inspector)
On Error Resume Next
EndTimer
Set GInspector = Nothing
Set GInspector = Inspector
StartTimer
End Sub 3. 在 Microsoft Visual Basic for Applications 視窗中,點選插入 > 模組,然後將下列 VBA 程式碼複製到模組視窗中。

VBA 程式碼:在 Outlook 中回覆或轉寄時為多個電子郵件帳戶設定不同簽名 —— 模組
Public Declare PtrSafe Function SetTimer Lib "user32" (ByVal HWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As LongPtr) As Long
Public Declare PtrSafe Function KillTimer Lib "user32" (ByVal HWnd As Long, ByVal nIDEvent As Long) As Long
Public TimerID As Long
Public GInspector As Inspector
Sub StartTimer()
On Error Resume Next
TimerID = SetTimer(0&, 0&, 1000&, AddressOf TimerProc)
End Sub
Sub EndTimer()
On Error Resume Next
KillTimer 0&, TimerID
End Sub
Sub TimerProc(ByVal HWnd As Long, ByVal uMsg As Long, ByVal nIDEvent As Long, ByVal dwTimer As Long)
On Error Resume Next
Call SetSignatureToAccount
EndTimer
End Sub
Sub SetSignatureToAccount()
‘Update by ExtendOffice
Dim xMail As MailItem
Dim xSignatureFile, xSignaturePath As String
Dim xSubject As String
Dim xDoc As Document
Dim xAccount As Account
Dim xIsNew As Boolean
Dim xInspector As Inspector
Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
On Error Resume Next
xSignaturePath = CreateObject("WScript.Shell").SpecialFolders(5) + "\Microsoft\Signatures\"
xSubject = GInspector.Caption
Set xDoc = GInspector.WordEditor
xIsNew = False
Set xMail = GInspector.CurrentItem
Select Case xMail.Parent.Parent
Case "name1@example.com" 'Replace the email address in double quotes
If VBA.InStr(xSubject, "RE: ") Then
xSignatureFile = xSignaturePath & "Signature1.htm" 'Replace "Signature1" with your actual signature name that you will set as the signature when you reply to a message.
ElseIf VBA.InStr(xSubject, "FW: ") Then
xSignatureFile = xSignaturePath & "Signature2.htm" 'Replace "Signature2" with your actual signature name that you will set as the signature when you forward a message.
Else
xIsNew = True
Exit Sub
End If
Case "name2@example.com" 'Replace the email address in double quotes
If VBA.InStr(xSubject, "RE: ") Then
xSignatureFile = xSignaturePath & "Signature3.htm" 'Replace "Signature3" with your actual signature name that you will set as the signature when you reply to a message.
ElseIf VBA.InStr(xSubject, "FW: ") Then
xSignatureFile = xSignaturePath & "Signature4.htm" 'Replace "Signature4" with your actual signature name that you will set as the signature when you forward a message.
Else
xIsNew = True
Exit Sub
End If
'Add more Cases for more email accounts
End Select
If xIsNew = True Then
With xDoc.Application.Selection
.WholeStory
.EndKey
.InsertParagraphAfter
.MoveDown Unit:=wdLine, Count:=1
.InsertFile FileName:=xSignatureFile, Link:=False, Attachment:=False
End With
Else
With xDoc.Application.Selection
.MoveRight Unit:=wdCharacter, Count:=1
.HomeKey Emptyparam, Emptyparam
.InsertFile FileName:=xSignatureFile, Link:=False, Attachment:=False
End With
End If
Set xDoc = Nothing
Set GInspector = Nothing
Set xMail = Nothing
End Sub - 1) 請將第 39 列與第 48 列中的 name 1@example.com 及 name 2@example.com 替換為您實際的電子信箱地址。
- 2) 請依照註解,將第 41、43、50 和 52 列中的 Signature 替換為您實際的簽名名稱。
- 3) 透過上述 VBA 程式碼,我們可為兩個電子郵件帳戶新增簽名。若您擁有更多帳戶,請以更多 Cases 取代程式碼的第 57 列:
If VBA.InStr(xSubject, "RE: ") = 1 Then
xSignatureFile = xSignaturePath & "Signature 1.htm"
ElseIf VBA.InStr(xSubject, "FW: ") = 1 Then
xSignatureFile = xSignaturePath & "Signature 2.htm"
Else
xIsNew = True
Exit Sub
End If
4. 在 Microsoft Visual Basic for Applications 視窗中,點選工具 > 參考,勾選 Microsoft Word 16.0 物件庫 旁的核取方塊,再點選確定即可。

5. 重新啟動 Outlook,並儲存 VBA 程式碼。
6. 現在,當您使用已設定簽名的電子郵件帳戶回覆或轉寄郵件時,系統將自動插入對應的簽名。
注意:若您發現使用電子郵件帳戶回覆或轉寄郵件時出現兩個簽名,請在郵件視窗中點選簽名 > 簽名。在「選擇預設簽名」區段中,選取該電子郵件帳戶,並於回覆/轉寄的下拉選單中選擇(無)。

相關文章
如何在 Outlook 中匯入或插入 HTML 格式的簽名?
例如,您從網站下載了 HTML 格式的郵件簽名,想輕鬆匯入 Outlook?本文將一步步帶您完成 HTML 簽名的匯入與插入。
在 Outlook 電子郵件中新增或移除背景顏色十分簡單,但該如何在 Outlook 簽名中插入或移除背景顏色呢?以下解決方法可協助您輕鬆完成此操作:
在 Outlook 中撰寫新郵件時,如何為多個電子郵件帳戶分別設定不同的簽名?
如果您希望 Outlook 在撰寫新郵件時自動插入簽名,請透過點選「簽名 > 簽名」來設定預設簽名,並為特定電子郵件帳戶指定對應的簽名(如下圖所示)。然而,若您擁有眾多電子郵件帳戶,並希望一次為多個帳戶分別設定不同的簽名,該如何操作?本教學將介紹一種 VBA 方法,助您輕鬆達成此目標。
一般來說,您可以在 Outlook 中為不同帳戶設定各自的簽名,但您是否曾試過為「回覆」與「轉寄」郵件分別套用不同的簽名?也就是說,當您回覆郵件時自動插入簽名 1,而轉寄郵件時則套用簽名 2. 該如何在 Outlook 中實現這個功能呢?
最佳 Office 生產力工具
體驗全新 Kutools for Outlook,內含 100+ 項超強功能!立即點擊下載!
🤖KUTOOLS AI:運用先進 AI 技術,輕鬆處理電子郵件——無論是回覆、摘要、優化、擴充、翻譯還是撰寫郵件,通通一鍵搞定!
📧 郵件自動化:自動答覆(支援 POP 與 IMAP)/預約寄送郵件/寄信時依規則自動抄送密送/自動轉發(高級規則)/自動加入問候語/自動將多收件人郵件拆分為個別訊息……
📨 郵件管理:撤回郵件/依主旨等條件封鎖詐騙郵件/刪除重複郵件/高級搜尋/整合文件夾……
📁 附件專業版:批次儲存/批次解除附加/批次壓縮/自動保存/自動拆離/自動壓縮……
🌟 介面魔法:😊更多精美酷炫表情符號/重要郵件來到時提醒您/最小化 Outlook 而非關閉……
👍 一鍵奇蹟:帶附件全部答復/防釣魚郵件/🕘顯示發送者當前時間時區……
👩🏼🤝👩🏻 聯絡人與行事曆:從選取的郵件中批次新增聯絡人/將聯繫人組拆分為個別群組/移除生日提醒……
用您的慣用語言暢享 Kutools — 完整支援英文、西班牙文、德文、法文、中文等 40 多種語言!
立即一鍵解鎖 Kutools for Outlook!別再等待,馬上下載,全面提升工作效率!


🚀 一鍵下載 — 立即取得所有 Office 增益集
強烈推薦:Kutools for Office(5 合 1)
一鍵下載五個安裝程式,一次完成 — 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