跳到主要内容

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