by Svetlana Cheusheva, updated on
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 :)
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].
And here is the VBA code that will ask for the values to fill in based on the subject of the email:
For each variable mentioned in the code, a separate input box will be displayed:
The values you enter in the boxes will appear exactly where they should in the message:
There are two key points in the code that you should take notice of:
Here's a short summary of the steps to make an email template with variables and send a message based on the template:
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:
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.
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:
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.
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.
You can now save your template or add a few more macros if you have more than one fillable field.
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.
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.
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:
A moment later, your message with all the necessary information is ready to be sent:
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!
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:
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.
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):
After all these customizations, our Outlook email template with two dropdown lists looks as follows:
When inserting the template in a message, the following form will appear asking you to select both values:
Tip. To add other types of drop-down menus to you templates, please check out these examples:
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!
Why Shared Email Templates? Top 10 reasons (.pdf file)
Table of contents