Use macros in templates

In Shared Email Templates for Microsoft Outlook

With the Shared Email Templates macros, you can easily avoid repetitive actions. You can automatically attach files, insert pictures, or fill in the To, Cc, Bcc, and Subject fields. You can also create fillable fields that are replaced with the necessary values either automatically or via interactive dialogs when you insert a template containing such fillable fields into an email.

Note. A maximum of one nested level of macros is supported: ~%Macro1{~%Macro2{}}

To download a quick Macros cheat sheet, click the button below.

Download cheat sheet

Video: How to create auto-fillable fields

How to create auto-fillable fields

Watch this video to learn how to automatically fill the Cc field, insert the name of your addressee into the body of an email message, and add images, attachments, and dates with Shared Email Templates.

Run time: 04:16

How to add interactive fields to Outlook messages

How to add interactive fields to Outlook messages

Watch this video to easily create fields for entering a text value, selecting from a dropdown, picking a date or time, and selecting a value from a dataset.

Run time: 03:48

How to insert a macro into your template

  1. Start creating a new template or editing an existing one. In the text of the template, place the cursor where you want to insert a macro, and then click Insert macro.
    The Insert macro button on the template editor toolbar
  2. Select a macro.
    Select a macro.

    Tip. To quickly find a macro, use the search box.

An inserted macro is shown in the text of a template with a macro placeholder.
A sample template with a macro placeholder

Tip. If you want to see the formatting applied to macro placeholders, change the Default macros style to the Dashed one.

Choose a macros style

You can choose between two macros styles: Default and Dashed. With the Dashed macros style, you can see formatting that is applied to macro placeholders in your templates.

Default macros style Dashed macros style
Default macros style Dashed macros style

You can change the Default macros style to the Dashed one by going to Profile > My Account > Edit my account.
Switching to the Dashed macros style

What macros do and how to use them

With Shared Email Templates macros you can:

  • Create interactive fillable fields.
  • Fill in To, Cc, Bcc, and Subject.
  • Attach files and insert pictures.
  • Create auto-fillable fields.
  • Use regular expressions to find matching data.
  • Create mail merge fields.
  • Disable inserting templates.
  • Add internal notes to templates.
  • Clear the fields and the body of email messages.

Groups of Shared Email Templates macros

Create interactive fillable fields

To create interactive fillable fields that will be replaced with values you enter or select via interactive dialogs when inserting templates into email messages, use the WhatToEnter macro. For detailed information, visit this help page: Add interactive fillable fields.

Fill in To, Cc, Bcc, and Subject

To put some email addresses or text into email fields, you can use the Fill and Add macros.

Note. It doesn't matter where in the text of a template you insert the Fill and Add macros. They don't show up in the message body.

  • You can insert the necessary email addresses (separated by semicolons) into the To, Cc, and Bcc fields with the Fill macro. Any email addresses that were added previously will be deleted.
  • The Fill macro can also help you fill in the Subject field with the text you need. The text that was added to the Subject field previously will be deleted.
  • If you want to add some email addresses (separated by semicolons) to the To, Cc, and Bcc fields, the Add macro will be helpful. All the email addresses added previously will be kept.
  • With the Add macro, you can also add the necessary text to the Subject field. The text you already have there will be kept.

    By default, the text added by the Add macro is inserted after the text that the Subject field already contains. If you want to add the text to the beginning of the Subject, select the Before checkbox when inserting the Add macro.
    The Before checkbox in the Add to Subject line dialog

Attach files

Attach files from OneDrive, SharePoint, or URLs with the Attach macro. Or use the WhatToAttach macro to create a reminder. Here is the detailed guide: How to attach files to your templates

Insert images

To insert images from OneDrive, SharePoint, or URLs, use the InsertPicture macro. For more information, visit the How to insert pictures into your templates page.

Create auto-fillable fields

Create auto-fillable fields to automatically insert information into the message body.

Insert the subject line content, a date, or time into the message body

If you want to insert the Subject line content into the message body, use the Insert macro. This macro can also help you add the current date and current time to your email message.

Insert addresses from the To, Cc, and Bcc fields into the message body

Use the Insert macro to insert the content of the To, Cc, or Bcc field into the message body.

Insert the recipient and sender names into the message body

You can insert the first, full, or last name of the recipient or the sender into the message body with the Insert macro.

Note. If the name of the recipient isn't displayed in the To field, the macro will insert the recipient's email address instead.

Insert mailbox, profile, and team properties into the message body

To easily add mailbox, profile, and team properties to your templates, use the Insert macro. Here is the How to use team, profile, mailbox properties guide.

Insert a value from a dataset into the message body

Use the DatasetValue macro to insert a value from a dataset into the message body. Learn more.

Add internal notes to templates

To leave an internal note in a template for yourself or your teammates, use the Note macro. It will be present only in the template itself and won't change an email message.

In the template preview, the macro placeholder looks like this:
A note in the template preview

To see the text of a note, simply hover the cursor over the macro placeholder. To open the note, click the macro placeholder.
An open note in the template preview

If you want notes to open automatically, choose one of the two following ways:

  • When inserting the Note macro into a template, select the Auto expand checkbox in the macro dialog.
    The Auto expand checkbox in the Note macro dialog

    As a result, such a note will open automatically.

  • Add the AutoExpandNoteMacros property with the "true" value to your profile or team properties.
    Adding the AutoExpandNoteMacros property

    As a result, all the notes you have in your templates will open automatically for your profile or for your team(s).

Clear the message body

The Clear macro will help you clear the message body as well as the To, Cc, Bcc, and Subject fields.

Disable inserting a template

With the DisableIf macro, a template won't be inserted if the condition that you specified is met.

Macros for meetings and appointments in Outlook

You can create appointments and schedule meetings with the help of templates and use, for example the Fill, Add, and Insert macros in them. Detailed information is available on the Templates for appointments and meetings page.

Nested macros

Note. You can use nested macros as long as they don't exceed one nested level.

If you want to combine two macros making them work together for you, just nest one of them within the other. Suppose you would like not only to automatically fill in the Subject line with some text but also to have the opportunity to change this text if necessary. In this case, you'll need to nest the WhatToEnter macro in the Fill macro.

  1. Select Fill Subject and click the Insert nested macro button in the Fill Subject line dialog that will appear.
    The Insert nested macro button
  2. Select What to Enter, fill in the fields that the What to enter dialog contains, and then click OK.
    The WTE macro that is going to be nested
  3. In the Fill Subject line dialog, click OK.
    Nest the WTE macro.

When inserting such a template into your email message, you'll see a dialog showing your default text for the Subject line. You can always change that text if you want to.
The nested WTE in action

Responses

Lawson Jones says:
April 6, 2022 at 5:54 pm

Hi, is there I can enter some of my ~%WhatToEnter into the Subject? For example, some of my fillable fields include the date of an event and the event name. I would like those to automatically appear in the subject as well.

Can I format a date? or even display just a part like DATE(MONTH) ?

Hello Cristian,

Thank you for your questions.

If I understand your request correctly, please try to use the ~%WhatToEnter macro that allows you to pick a date in the calendar when inserting a template into a message. You can also set a certain format and language for your dates. For more details, please see this guide:
https://www.ablebits.com/docs/outlook-shared-templates-macros-whattoenter/#date

If it is not exactly what you need, then please clarify your request.

Vignas Gunasegaran says:
February 15, 2021 at 4:25 pm

I have unique links that I send a lot, I would l like the hyperlink to be "click me" style but is there a quick way to get that added in when i start the snippit via what to enter?

Hi,

I just cannot get the results from the ~%WHAT_TO_ENTER[] macro you posted above here.
The syntax of Pick Date ist unclear as well as I do not get the result even when trying to copy your examples here.I still get the Question Box (which does look different then yours given here) and everything is an item from the dropdown list, that's it.
Can you please provide the full syntax and potential options ?

Hello Lars,

Thank you for your comment. Sorry to hear that the instructions above are not clear for you.

If you'd like to insert a date into a certain place in your message using the ~%WHAT_TO_ENTER[] macro, please do the following:

- Click the New button at the bottom of the add-in pane to create a new template.
- Type in the template text and put the cursor where you'd like to insert a date. Then open the Insert Macro drop-down and choose ~%WHAT_TO_ENTER[] from the list.
- You will see the What To Enter dialog window with three fields. Click on the down arrow in the top field and select "Date".
- Enter the title for the window that will appear when inserting the template, for example, "Due date".
- Then click Insert, the macro will look as follows: ~%WHAT_TO_ENTER[{date,title:"Due date"}].
- Save the template and try to insert it into the email. When you do this, you will see the dialog box called "Due date" with the current date. You can click on the down arrow in the date field to open the calendar and pick another date.

If your case is different, then please explain in detail what you'd like to do and we'll help you with creating a necessary macro. Feel free to email us at support@ablebits.com for further assistance.

Hello, is it possible to get multi-line text as WHAT_TO_ENTER value?

Hello Giuseppe,

Thank you for your question. I have just replied to your query by email. Please check your Inbox.

Kelvin Niss says:
May 8, 2020 at 3:59 pm

I'm trying to use the WHAT_TO_ENTER to have it in a drop-down list, however it always appears to me like the last example, an empty box to type the information. Is there anything i can do to have it in a list?

Hello Kelvin,

If you want to have a drop-down list to be displayed when inserting the ~%WHAT_TO_ENTER[] macro, you should enter list items through a semicolon in the square brackets next to the macro name like in the example above, ~%WHAT_TO_ENTER[Item 1; Item 2; Item 3].

If you mean something different, then please send us the HTML code of your template for checking. Simply select the template you're having difficulties with and hit Edit. Then, find and click the icon to open the View HTML pane. Select all the text you see in the HTML window, copy it, paste in a Word document and send it to support@ablebits.com. We'll try to help.

There are times where I want to use ~%WHAT_TO_ENTER[] to get some information and then use it again later, but I don't want to have to ask again. Can you consider adding the ability to store and access variables? Something like ~%SAVE_TO_VARIABLE[1, Prompt Message] and ~%USE_VARIABLE[1]. You could use indexes to reference which variable to save and use and limit a template to say 10, 20, or whatever number makes sense.

Thanks

Hello Michael,

I have just replied to your query by email. Please provide us with the information requested in the email so that we'll be able to help you better. Thank you.

Hello
Same question.
Typically I want to use a ~%WHAT_TO_ENTER[] entry into body message AND into Subject field without typing twice.

Thanks

Post a comment

Seen by everyone, do not publish license keys and sensitive personal info!

If you have any questions or issues with this add-in, please feel free to post your concerns in the comments area. As soon as we answer, a notification message will be sent to your e-mail. If you do not want to share your thoughts in public, please contact us at support@ablebits.com.