跳到主要內容

Outlook回复或轉發時如何給多個郵箱添加不同的簽名?

從教程中: Outlook 中的電子郵件簽名,您應該知道如何在 Outlook 中創建簽名。 但是,創建新簽名後,如果要在回复或轉發消息時添加,則必須手動添加創建的簽名,方法是選擇 簽名 > 創建的簽名 在消息窗口中。

當然,您可以讓 Outlook 在您回复或轉發新郵件時自動添加簽名,方法是單擊 簽名 > 簽名,並為特定電子郵件帳戶選擇簽名,如下所示。

但是,如果您有多個郵箱賬號,想為多個賬號批量添加不同的簽名怎麼辦? 在本教程中,我將介紹一種 VBA 方法來幫助您輕鬆完成這項工作。


在 Outlook 中回复或轉發時為多個電子郵件帳戶添加不同的簽名

1. 在您的 Outlook 中,按 其他 + F11 鍵以打開“ Microsoft Visual Basic應用程序”窗口。

2. 在 Microsoft Visual Basic for Applications 窗口中,雙擊 本次展望會議 在“項目”窗格中,將下面的 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 "" '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 "" '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 行添加到您的實際電子郵件地址。
  • 2)你應該更換 簽名 第41、43、50、52行根據評論改成你的真實簽名。
  • 3) 通過上面的VBA代碼,我們可以為兩個郵箱賬號添加簽名。 如果您有更多帳戶,請將代碼的第 57 行替換為更多 Cases:
  • 案子 ”"
    如果 VBA.InStr(xSubject, "RE: ") = 1 那麼
    xSignatureFile = xSignaturePath & "Signature1.htm"
    ElseIf VBA.InStr(xSubject, "FW: ") = 1 然後
    xSignatureFile = xSignaturePath & "Signature2.htm"
    其他
    xIsNew = 真
    退出小組
    如果結束

4.在“ Microsoft Visual Basic for Applications”窗口中,單擊“ 工具 > 參考,選中旁邊的框 Microsoft Word 16.0對像庫,然後點擊 OK.

5. 重新啟動 Outlook,並保存 VBA 代碼。

6. 現在,當您使用已設置簽名的郵箱回复或轉發郵件時,會自動添加相應的簽名。

注意: 如果您在使用郵箱回复或轉發郵件時發現添加了兩個簽名,請點擊 簽名 > 簽名 在消息窗口中。 在選擇默認簽名部分,選擇具有兩個簽名的電子郵件帳戶,然後選擇 (無) 從回复/轉發下拉列表。


相關文章

如何在 Outlook 中導入或插入 HTML 簽名?

例如,您從網站下載了一些HTML簽名,並希望將其導入到Outlook中。 有什麼簡單的方法嗎? 本文將指導您逐步將HTML簽名導入或插入到Outlook中。

如何將背景顏色插入到 Outlook 簽名中?

在 Outlook 的電子郵件中添加或刪除背景顏色很容易。 但是,如何在 Outlook 簽名中插入或刪除背景顏色? 以下解決方法將幫助您解決它:

Outlook新建郵件時如何給多個郵箱添加不同的簽名?

如果您希望 Outlook 在您創建新郵件時自動添加簽名,您需要配置默認簽名,方法是單擊“簽名”>“簽名”,然後為特定電子郵件帳戶選擇一個簽名,如下所示。 但是,如果你有多個郵箱賬號,想為多個賬號批量添加不同的簽名怎麼辦? 在本教程中,我將介紹一種 VBA 方法來幫助您輕鬆完成這項工作。

如何在Outlook中為回復和轉發設置不同的簽名?

通常,您可以在Outlook中為不同的帳戶設置不同的簽名,但是,曾經嘗試對答復和轉發應用不同的簽名。 這意味著,當您回復電子郵件時,將插入signature1;當您轉發電子郵件時,將應用signature2。 您如何在Outlook中解決此任務?


最佳辦公生產力工具

Kutools for Outlook - 超過 100 種強大的功能可增強您的 Outlook

🤖 人工智慧郵件助手: 具備人工智慧魔力的即時專業電子郵件——一鍵天才回覆、完美語調、多語言掌握。輕鬆改變電子郵件! ……

📧 電子郵件自動化: 外出(適用於 POP 和 IMAP)  /  安排發送電子郵件  /  發送電子郵件時按規則自動抄送/密件副本  /  自動轉送(進階規則)   /  自動添加問候語   /  自動將多收件者電子郵件拆分為單獨的訊息 ...

📨 電子郵件管理: 輕鬆回憶電子郵件  /  按主題和其他人阻止詐騙電子郵件  /  刪除重複的電子郵件  /  進階搜索  /  合併資料夾 ...

📁 附件專業版批量保存  /  批量分離  /  批量壓縮  /  自動保存   /  自動分離  /  自動壓縮 ...

🌟 介面魔法: 😊更多又漂亮又酷的表情符號   /  使用選項卡式視圖提高 Outlook 工作效率  /  最小化 Outlook 而不是關閉 ...

👍 一鍵奇蹟: 使用傳入附件回覆全部  /   反網路釣魚電子郵件  /  🕘顯示寄件者的時區 ...

👩🏼‍🤝‍👩🏻 通訊錄和行事曆: 從選定的電子郵件中大量新增聯絡人  /  將聯絡人群組拆分為各組  /  刪除生日提醒 ...

超過 100特點 等待您的探索! 按此處了解更多。

閱讀更多       免費下載      購買
 

 

Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations