Note: The other languages of the website are Google-translated. Back to English

How to add different signatures to multiple email accounts when reply or forward in Outlook?

From the tutorial: Email Signatures In Outlook, you should know how to create a signature in Outlook. However, after creating a new signature, you will have to manually add the created signature if you want to add it when you reply to or forward a message by selecting Signature > The created signature in the message window.

Of course you can have Outlook add a signature automatically when you reply to or forward a new message by clicking Signature > Signatures, and selecting a signature for a specific email account as shown below.

However, what if you have many email accounts and want to add different signatures for your multiple accounts in batches? In this tutorial, I will introduce a VBA method to help you get this job done easily.


Add different signatures to multiple email accounts when reply or forward in Outlook

1. In your Outlook, press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, double click on ThisOutlookSession in the Project pane, and copy the below VBA code into the ThisOutlookSession (Code) window. See screenshot:

VBA code: Add different signatures to multiple email accounts when create a new email in 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. In the Microsoft Visual Basic for Applications window, click Insert > Module. Then copy the following VBA code to the Module window.

VBA code: Add different signatures to multiple email accounts when reply or forward in Outlook - Module

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
Note:
  • 1) You should replace the name1@example.com and name2@example.com in the 39th and 48th rows to your actual email addresses.
  • 2) You should replace Signature in the 41st, 43rd, 50th and 52nd rows to your actual signature names according to the comments.
  • 3) With the above VBA code, we can add signatures to two email accounts. If you have more accounts, replace the 57th row of the code with more Cases:
  • Case "name@example.com"
    If VBA.InStr(xSubject, "RE: ") = 1 Then
    xSignatureFile = xSignaturePath & "Signature1.htm"
    ElseIf VBA.InStr(xSubject, "FW: ") = 1 Then
    xSignatureFile = xSignaturePath & "Signature2.htm"
    Else
    xIsNew = True
    Exit Sub
    End If

4. In the Microsoft Visual Basic for Applications window, click Tools > References, check the box next to Microsoft Word 16.0 Object Library, and click OK.

5. Restart Outlook, and save the VBA codes.

6. Now, when you reply to or forward a message with an email account that you have set up a signature for, the corresponding signature will be added automatically.

Note: If you find there are two signatures added when you reply to or forward a message with an email account, please click Signature > Signatures in the message window. In the Choose default signature section, select the email account that has two signatures, and choose (none) from the Replies/forwards drop-down list.


Related articles

How To Import Or Insert HTML Signatures In Outlook?

For example, you downloaded some HTML signatures from websites, and want to import them in to your Outlook. Any easy ways? This article will guide you to import or insert HTML signatures into Outlook step by step.

How To Insert Background Color Into An Outlook Signature?

It’s easy to add or remove background color in an email in Outlook. But, how could you insert or remove background color in an Outlook signature? Below workarounds will help you solve it:

How To Add Different Signatures To Multiple Email Accounts When Create A New Email In Outlook?

If you want Outlook to add signature automatically when you create a new message, you’ll need to configure the default signature by clicking Signature > Signatures, and selecting a signature for a specific email account as shown below. However, what if you have many email accounts and want to add different signatures for your multiple accounts in batches? In this tutorial, I will introduce a VBA method to help you get this job done easily.

How To Set Different Signatures For Replies And Forwards In Outlook?

Normally, you can set different signatures for different accounts in your Outlook, but, have ever tried to apply different signatures for replies and forwards. It means, when you reply an email, the signature1 is inserted, when you forward an email the signature2 is applied. How could you solve this task in Outlook?


Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations

Follow Us

Copyright © 2009 - www.extendoffice.com. | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL