You want Outlook to automatically reply to certain incoming emails using a pre-designed OFT template. This saves time when you send the same formatted response, such as a quote, acknowledgment, or standard form letter. The cause of the repetitive manual work is that Outlook does not natively offer a rule action that says “reply with this OFT file.” This article explains a workaround using a VBA macro triggered by a rule so that Outlook replies with your specific OFT template.
The solution combines an Outlook rule that detects incoming messages and a VBA script that applies the OFT template as the reply body. You will learn how to create the OFT template, enable the Developer tab, write the macro, and link it to the rule. After completing these steps, Outlook will automatically reply with your custom template to matching emails.
This method works in Outlook for Microsoft 365, Outlook 2021, Outlook 2019, Outlook 2016, and Outlook 2013 on Windows 10 and Windows 11. The same approach works for both Exchange and IMAP accounts, but the VBA macro must be saved in a specific module to run reliably.
Key Takeaways: How to Set an Outlook Rule to Reply Using a Specific OFT Template
- Save an email as an OFT template: Create a custom reply format that contains your logo, signature, and standard text.
- Developer tab > Visual Basic: Write a VBA macro that opens the OFT file and inserts its body into a reply.
- File > Manage Rules & Alerts > Run a Script: Link the macro to a rule so it triggers automatically when a new message arrives.
What Is an OFT Template and Why Use a Rule for Replies
An OFT file is an Outlook Form Template. It stores the layout, formatting, images, and text of an email message. When you reply using an OFT template, the recipient sees a professionally formatted response instead of plain text. You can include company branding, legal disclaimers, and structured fields.
Outlook rules can perform many actions such as moving messages, forwarding them, or playing a sound. However, the built-in rule actions do not include replying with a specific template. The workaround is to create a rule that runs a script. The script is a VBA macro that reads the OFT file and applies its content to a reply message.
Prerequisites for this solution:
- Outlook must be installed on Windows 10 or Windows 11. The VBA macro engine is not available in Outlook for Mac or Outlook on the web.
- You need permission to run macros. If your organization blocks macros, contact your IT administrator.
- The OFT file must be saved in a folder that Outlook can access, such as the user’s Templates folder or a network path.
The macro approach requires basic familiarity with the Visual Basic Editor. You do not need to be a programmer. Copy the code provided in this article and adjust the file path to your OFT template.
Steps to Create the OFT Template and Set Up the Rule
Follow these steps in order. If you skip the template creation, the macro will have no file to load. If you skip the macro, the rule will do nothing.
Step 1: Create and Save the OFT Template
- Compose a new email with your desired formatting
Open Outlook and click New Email. Type the subject line and body text you want to use for automatic replies. Insert your company logo, signature block, and any standard legal text. Do not include the recipient address because the macro will reply to the original sender. - Save the message as an Outlook Template
Click File > Save As. In the Save as type dropdown, select Outlook Template (oft). Type a file name such as StandardReply.oft. Choose a location you can remember, such as C:\Users\YourName\AppData\Roaming\Microsoft\Templates. Click Save. This folder is the default Templates folder for Outlook.
Step 2: Enable the Developer Tab in Outlook
- Open Outlook Options
Click File > Options. - Customize the Ribbon
In the Outlook Options dialog, click Customize Ribbon. In the right pane under Main Tabs, check the box next to Developer. Click OK. The Developer tab now appears in the Outlook ribbon.
Step 3: Write the VBA Macro to Reply with the OFT Template
- Open the VBA Editor
Click the Developer tab, then click Visual Basic. Alternatively, press Alt+F11. - Insert a new module
In the VBA Editor, click Insert > Module. A blank code window opens. - Paste the macro code
Copy and paste the following code into the module window. Replace the file path with the full path to your OFT template.Public Sub ReplyWithOFT(Item As Outlook.MailItem)
Dim objReply As Outlook.MailItem
Dim objTemplate As Outlook.MailItem
Dim strTemplatePath As StringstrTemplatePath = "C:\Users\YourName\AppData\Roaming\Microsoft\Templates\StandardReply.oft"
Set objTemplate = Application.CreateItemFromTemplate(strTemplatePath)
Set objReply = Item.ReplyobjReply.HTMLBody = objTemplate.HTMLBody
objReply.Subject = objTemplate.Subject
objReply.DisplaySet objReply = Nothing
Set objTemplate = Nothing
End Sub - Save the macro
Press Ctrl+S. If prompted to allow macro access, click Yes. Close the VBA Editor.
Step 4: Create the Outlook Rule That Runs the Macro
- Open the Rules and Alerts dialog
Click File > Manage Rules & Alerts. In Outlook 2016 and later, you can also click the Rules button on the Home tab and select Manage Rules & Alerts. - Create a new rule
Click New Rule. Select Apply rule on messages I receive. Click Next. - Set the conditions
Check the conditions that trigger the rule. For example, check Sent To if you want the rule to apply only to messages sent to a specific address. Check With specific words in the subject if you want to reply only to messages about a certain topic. Click the underlined value to enter your criteria. Click Next. - Select the action: run a script
Scroll through the action list and check run a script. In the Step 2 box, click the underlined script name. Choose ReplyWithOFT from the list. Click OK. Click Next. - Set exceptions if needed
Add any exceptions such as except if from a specific sender. Click Next. - Name and enable the rule
Type a name for the rule, for example “Auto Reply with Standard Template.” Check Turn on this rule. Click Finish.
The rule is now active. When a new message arrives that matches your conditions, Outlook runs the macro. The macro creates a reply, pastes the HTML body from your OFT template, and displays the reply window. The reply is not sent automatically. You must click Send manually. If you want the reply to be sent automatically, add the line objReply.Send before the cleanup lines in the macro.
If the Rule Does Not Reply with the Correct Template
The macro does not run at all
Check that macros are enabled. In Outlook, click File > Options > Trust Center > Trust Center Settings > Macro Settings. Select Notifications for digitally signed macros, all other macros disabled or Enable all macros. The latter is less secure but necessary for unsigned macros. After changing the setting, restart Outlook.
The reply shows the wrong formatting or missing images
Images in an OFT template are linked, not embedded. When you save the template, images are stored as references. If the image file is moved or deleted, the reply will show a broken image icon. To avoid this, embed images directly in the OFT file. In the original email, right-click the image and select Change Picture > Browse to insert the image from a file. Then save the OFT again.
The rule runs but the reply window does not appear
The macro code in this article calls objReply.Display which shows the reply window. If you removed that line, the reply is created in memory but not shown. If you added objReply.Send without .Display, the reply is sent silently. Verify your macro code includes .Display or .Send depending on your goal.
Outlook prompts for permission every time the macro runs
This happens when the macro is not signed. To avoid prompts, self-sign the macro using the Digital Certificate tool that comes with Office. Open the VBA Editor, click Tools > Digital Signature > Choose > New, and create a certificate. Then save the project. This certificate is valid only on your computer.
The rule is grayed out or says “This rule cannot be applied to this account”
The run a script action works only on Exchange, Microsoft 365, and IMAP accounts. It does not work with POP3 accounts. If you use POP3, switch to IMAP or use an Exchange account. Also, the rule must be a client-only rule. Server-based rules cannot run scripts.
Manual Reply with Template vs Automated Rule: Key Differences
| Item | Manual Reply with Template | Automated Rule with VBA |
|---|---|---|
| Trigger | User clicks Reply and selects template | Incoming message matches rule conditions |
| Speed | Slower, requires multiple clicks | Instant, no user action needed |
| Customization per message | User can edit before sending | Template is applied verbatim; manual editing still possible if .Display is used |
| Setup effort | None beyond creating the template | Requires macro creation and rule configuration |
| Security | No macro security concerns | Macros must be enabled; may be blocked by IT policy |
| Account compatibility | All account types | Exchange, Microsoft 365, IMAP only; not POP3 |
This article showed you how to set an Outlook rule that replies using a specific OFT template by combining a rule condition with a VBA macro. You created the OFT template, wrote the macro, and linked it to the rule. To extend this solution, try adding multiple conditions or using multiple OFT templates for different scenarios. For advanced control, modify the macro to insert the original message body below the template or to include attachments from the OFT file.