How to Auto Apply a Specific Template When Replying to a Specific Person in Outlook

Outlook has no native feature to automatically use a specific message template to reply to the emails from a specific sender. Thus, if you would like to do this, you can refer to the method introduced in this article, which is resorting to Outlook VBA.

Outlook permits you to create and design custom message templates. However, when you need to apply a template, the only is to select and open it from “Choose Form” dialog box. Apparently, it is considerably inconvenient. Also, by this means, you can open use a template to create a new email, but can’t apply a template to a reply. Therefore, if you would like to always and auto use a specific mail template to reply to a specific person, you need to seek other approaches. Here we will tell you how to achieve it with Outlook VBA.

apply specific template to reply to specific persons

Auto Use a Specific Message Templates When Replying to a Specific Person

  1. In the first place, launch your Outlook program.
  2. Then you can press “Alt + F11” key shortcuts to get access to the VBA editor.
  3. Next, in the new window, you need double click the “ThisOutlookSession” on the left side to open this VBA project.
  4. Subsequently, you can copy and paste the following VBA codes into it.
Public WithEvents objInspectors As Outlook.Inspectors
Public WithEvents objExplorer As Outlook.Explorer
Public WithEvents objMail As Outlook.MailItem

Private Sub Initialize_Handlers()
    Set objInspectors = Application.Inspectors
    Set objExplorer = Outlook.Application.ActiveExplorer
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
    If TypeOf Inspector.CurrentItem Is MailItem Then
    Set objMail = Inspector.CurrentItem
    End If
End Sub

Private Sub objExplorer_SelectionChange()
    On Error Resume Next
    Set objMail = objExplorer.Selection.Item(1)
End Sub

Private Sub objMail_Reply(ByVal Response As Object, Cancel As Boolean)
    Dim strSenderEmailAddress As String
    Dim objTempReply As Outlook.MailItem
    Dim objNewMail As Outlook.MailItem

    'Change the email address as per your case
    strSenderEmailAddress = "johnsmith@datanumen.net"

    If objMail.SenderEmailAddress = strSenderEmailAddress Then
       Set objTempReply = objMail.Reply

       'Create an email using a specific template
       'Change the path to the specific template as per your case
       Set objNewMail = Outlook.Application.CreateItemFromTemplate("C:\Users\Test\Documents\UserTemplates\Test Mail.oft")
       'Copy the subject, recipients and body from the reply to the new email
       With objNewMail
            .To = objTempReply.To
            .Subject = objTempReply.Subject
            .HTMLBody = objNewMail.HTMLBody & objTempReply.HTMLBody
            .Display
       End With

       'Close the replies
       objTempReply.Close (olDiscard)
       Cancel = True
    End If
End Sub

VBA Codes - Auto Apply a Specific Template When Replying to a Specific Person

  1. After that, you can assign your digital certificate to the new VBA project.
  2. Later you ought to restart Outlook to activate this macro.
  3. Finally you can have a try.
  • First, open one email from the specific person.
  • Then click the “Reply” button in the ribbon.Reply an Email from a Specific Person
  • At once, a new email window will display, which is using the specific mail template and is totally same as a standard reply email, like the following screenshot.Reply Using Specific Email Template

Defend Your Outlook Data from Corruption

Since Outlook is vulnerable, safeguarding your Outlook data is a blazing arduous task. Even so, you still should make some necessary precautions, such as making a regular backup for your Outlook data and keeping a preeminent Outlook repair tool like DataNumen Outlook Repair, etc.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf corruption and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.