Create Outlook email template with fillable fields, variables, and dropdown (2024)

Three ways to create an email template with variables, text field or dropdown list that will ask for the values to fill in before sending out an email.

If replying to repetitive emails is part of your daily routine, then most likely you are using Outlook templates to automate this part of your work. But what if your template contains some variables that you need to change before an email goes off. Editing data manually is not the best way, as there is always a chance you may forget to update some important details. So, the question is - how do I create a template that will prompt me to enter the information and automatically insert it into the appropriate place in a message? The get the answer, please continue reading :)

Make Outlook email template with variables using VBA

This example shows how to insert variable information in an email template using a macro. To keep things simple, I've created this small template with two fields to enter in a message body, [date] and [percent].
Create Outlook email template with fillable fields, variables, and dropdown (1)

And here is the VBA code that will ask for the values to fill in based on the subject of the email:

Private WithEvents m_Inspectors As Outlook.Inspectors Private WithEvents m_Inspector As Outlook.Inspector Private Sub Application_Startup() Set m_Inspectors = Application.Inspectors End Sub Private Sub m_Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector) If TypeOf Inspector.CurrentItem Is Outlook.MailItem Then 'Handle emails only Set m_Inspector = Inspector End If End Sub Private Sub m_Inspector_Activate() Dim Item As MailItem Dim Value As String If TypeOf m_Inspector.CurrentItem Is MailItem Then Set mail = m_Inspector.CurrentItem 'Identify the message subject If mail.Subject = "Your subscription expires soon" Then 'Check message format If mail.BodyFormat = OlBodyFormat.olFormatPlain Then 'Replace [date] with the entered value If InStr(mail.Body, "[date]") > 0 Then Value = InputBox("Enter the expiry date") If Value <> "" Then mail.Body = Replace(mail.Body, "[date]", Value) End If End If 'Replace [percent] with the entered value If InStr(mail.Body, "[percent]") > 0 Then Value = InputBox("Enter percentage discount") If Value <> "" Then mail.Body = Replace(mail.Body, "[percent]", Value) End If End If Else 'Replace [date] with the entered value If InStr(mail.HTMLBody, "[date]") > 0 Then Value = InputBox("Enter the expiry date") If Value <> "" Then mail.HTMLBody = Replace(mail.HTMLBody, "[date]", Value) End If End If 'Replace [percent] with the entered value If InStr(mail.HTMLBody, "[percent]") > 0 Then Value = InputBox("Enter percentage discount") If Value <> "" Then mail.HTMLBody = Replace(mail.HTMLBody, "[percent]", Value) End If End If End If End If Set mail = Nothing End IfEnd Sub

For each variable mentioned in the code, a separate input box will be displayed:
Create Outlook email template with fillable fields, variables, and dropdown (2)

The values you enter in the boxes will appear exactly where they should in the message:
Create Outlook email template with fillable fields, variables, and dropdown (3)

How this macro works

There are two key points in the code that you should take notice of:

  • The template is identified by its subject. In our case, it's " Your subscription expires soon". Be sure to replace this text with the subject of your template.
  • In our sample code, there are two placeholders, [date] and [percent]. You can modify them as needed. Please pay attention that there are 4 instances of each placeholder in the code, not counting comments, and all of them should be replaced with your own placeholders. If you have more variables, then add a similar block of code for each of them (please see the code parts with the corresponding comments).

How to create an email template with variables using the macro

Here's a short summary of the steps to make an email template with variables and send a message based on the template:

  1. Create a new email, insert the text in the message body, put placeholders where needed, and fill in the Subject line with some unique text that is going to be used only in the subject of this specific template.
  2. Save your message as Outlook template (*.oft). For the detailed instructions, please see How to create an email template in Outlook.
  3. Press Alt + F11 to open the VBA editor, paste the macro's code into the ThisOutlookSession module, and save the project (Ctrl + S).
  4. Restart Outlook.
  5. Create an email message based on the template you've just created. The detailed steps can be found here: How to send a message based on an email template.
  6. In each input box, type the value you are asked for.
  7. Review the finalized message and hit Send.

Email template with variables not working

If the VBA code does not work as expected or does not work at all in your Outlook, it's likely to be one of these reasons:

  1. You have not restarted Outlook after inserting the code in the VBA editor. Outlook restart is required to execute the code in the Startup event handler.
  2. Mail.Subject in your code does not correspond to the subject of your template.
  3. The placeholders in the code are not exactly same as in your template.
  4. Irrespective of how many macros there are in the ThisOutlookSession module, the first two lines of our code (Private WithEvents...) should be in the General declarations section at the top of the Code window, before any other code.
  5. Macros are disabled in your Outlook. To check this, click File > Options > Trust Center > Trust Center Settings > Macro Settings and select either:
    • Notifications for all macros
    • Enable all macros (not recommended)

    Please be aware that the second option allows all macros to run, including potentially malicious codes, so it is safer to choose the first one.

Create Outlook email template with fillable fields

Now, let's explore a different approach to the same task. This time we are going to use our own tool named Shared Email Templates for Outlook. If you have never heard of it before, here is a one-sentence intro:

Shared Email Templates is an Outlook add-in to quickly create your own collection of templates with predefined or fillable fields, custom formatting, images, and attachments.

What makes it different from. oft templates? This example will show you :)

With Shared Email Templates installed in your Outlook, carry out these steps to create a fillable template:

  1. On the add-in's pane, select the target folder and click the New Template button.

    If the text you want to include in your template is in the message you are composing, select that text, and then click New Template. The selected text will be inserted into your template automatically.
    Create Outlook email template with fillable fields, variables, and dropdown (4)

  2. If we wanted a simple text template, we could click Save right away, and our job would be completed. But you do want a field where you can enter some information, so it will be automatically inserted in the appropriate place in the message, right? So, let's go make the first one.

    In the template's text, select your placeholder (<date> in our case), and click the Insert Macro button. If there is no placeholder in your template, then put the cursor exactly where your value should be inserted.
    Create Outlook email template with fillable fields, variables, and dropdown (5)

  3. In the list of macros, find WhatToEnter and click on it.
    Create Outlook email template with fillable fields, variables, and dropdown (6)
  4. Choose the field type (Date in our case), type the window title (usually, some meaningful name for the value to enter) and click Insert.
    Create Outlook email template with fillable fields, variables, and dropdown (7)
  5. As the result, a properly configured macro is inserted in your template as shown in the screenshot:
    Create Outlook email template with fillable fields, variables, and dropdown (8)

    You can now save your template or add a few more macros if you have more than one fillable field.

  6. As our template has one more placeholder (<%>), we select it and click the Insert Macro icon again. This time we choose Text in the first box, type the corresponding window title, and click Insert.
    Create Outlook email template with fillable fields, variables, and dropdown (9)
  7. Apply some formatting to your template if needed, name it and save.
    Create Outlook email template with fillable fields, variables, and dropdown (10)

Done! Your fillable email template for Outlook is good to go.

Note. Shared Email Templates macros are not VBA macros. They are kind of placeholders in a template that are replaced with corresponding values in a message. All functional code is executed on the add-in's side, so there is no need to enable macros in your Outlook.

How to use an email template with input fields

Preparing an email template for sending out is as easy as it could possibly be. To insert a template into a message, double-click on it or click the Paste icon on the left.
Create Outlook email template with fillable fields, variables, and dropdown (11)

A small form will show up asking you to pick a date from a dropdown calendar and enter a percentage discount in the text box:
Create Outlook email template with fillable fields, variables, and dropdown (12)

A moment later, your message with all the necessary information is ready to be sent:
Create Outlook email template with fillable fields, variables, and dropdown (13)

Tip. Want to automatically fill in the Subject line or To, Cc and Bcc fields? Shared Email Tempalte's macros can do all this and a lot more things!

Insert dropdown in Outlook email template

The steps to add a dropdown list to your email template are the same as described above. The only difference is step 4 where you configure the What To Enter fields:

  • In the first box, choose Dropdown list.
  • In the Window Title box, put some text that will remind you what kind of value you will be selecting (Number of days before expiry in our case).
  • In the Items box, type the dropdown values one per line.

To be able to enter a value other than in the dropdown list, select the User can edit selected items checkbox. To limit the input to the predefined items, leave this box unselected.
Create Outlook email template with fillable fields, variables, and dropdown (14)

The finalized macro that will trigger our dropdown list takes this form:

~%WhatToEnter[3;5;10;{title:"No. of days before expiry",editable}]

If any changes are needed at a later point, you can edit the dropdown items directly in the template without recreating the macro from scratch.

In a similar fashion, we insert one more macro for the percentage discount. In this case, we limit the choices to only the items in the drop-down list (the User can edit selected items checkbox is unselected):
Create Outlook email template with fillable fields, variables, and dropdown (15)

After all these customizations, our Outlook email template with two dropdown lists looks as follows:
Create Outlook email template with fillable fields, variables, and dropdown (16)

When inserting the template in a message, the following form will appear asking you to select both values:
Create Outlook email template with fillable fields, variables, and dropdown (17)

Tip. To add other types of drop-down menus to you templates, please check out these examples:

  • How to make multi-select dropdown with checkboxes
  • How to populate dropdown list from database
  • How to create a fillable email template from a dataset

It is also possible to insert user-specific text, images, and attachments in each individual message automatically. This tutorial explains how: How to create dynamic Outlook email template for current user.

This was a quick demonstration of just one capability of Shared Email Templates. You can find plenty more useful features on the above linked page. Curious to give it a try? Download a free version from Microsoft AppSource.

That's how you can create an email template with fillable or dropdown fields. Thank you for reading and hope to see you on our blog next week!

Available downloads

Why Shared Email Templates? Top 10 reasons (.pdf file)

Other ways to reply with template in Outlook:

  • Quick Parts - small building blocks for your emails. Easy to create but lacking some important features such as attaching files.
  • Outlook templates (.oft files) - hidden deep in the interface, they are still quite useful when sending dozens of repetitive emails.
  • Outlook email template with attachments - reusable email templates that include the files you need to send.
  • Quick Steps - kind of shortcuts to automate repetitive tasks in Outlook.
  • Outlook signatures - used by almost everyone, they should not necessarily be limited to standard information. Your signature can be an entire email, and you can create as many of them as you want.
  • Mail Merge in Outlook - send personalized mass mailings using templates.

The article delves into creating Outlook email templates with variables, using VBA (Visual Basic for Applications) to prompt users for information to fill in placeholders in the template. It demonstrates two methods: one involving VBA code that uses input boxes to fill variables based on the email's subject and another using an Outlook add-in called Shared Email Templates.

The VBA method is detailed with code that identifies the email's subject and replaces placeholders like [date] and [percent] with values input via dialog boxes. It provides troubleshooting tips and instructions on modifying the code for additional variables.

The Shared Email Templates method involves an Outlook add-in that simplifies template creation by allowing users to create fields, macros, and dropdowns within templates. This method doesn't rely on VBA macros and operates on the add-in's side, enabling users to create fillable templates without enabling macros in Outlook. It guides users through creating templates with placeholders, inserting macros for fillable fields, formatting, and saving templates for later use.

Additionally, the article briefly touches upon adding dropdown lists to templates using the add-in, explaining how to configure dropdown fields and customize the dropdown options for user selection.

In summary, the article provides step-by-step guidance on:

  1. Using VBA to create email templates with variables and input boxes.
  2. Utilizing an Outlook add-in, Shared Email Templates, to create fillable email templates with macros for input fields, dropdown lists, and formatting.
  3. Enhancing templates with dropdown lists and guiding users on customization options.
  4. Offering alternative methods like Quick Parts, Outlook templates, email templates with attachments, Outlook signatures, and Mail Merge in Outlook for sending repetitive or personalized emails.

This comprehensive guide covers various approaches to streamline email creation, catering to different user preferences and technical skill levels.

Create Outlook email template with fillable fields, variables, and dropdown (2024)
Top Articles
Latest Posts
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 6770

Rating: 4.7 / 5 (67 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.