How to use macros in templates

In Shared Email Templates for Outlook

Macros let you avoid performing repetitive actions. For example, macros allow creating templates with attachments, so that each time you write a certain kind of message, you don't have to remember to add a particular file. You can fill in the Bcc, Cc, Subject email fields, and add information to the message body.

On this page, find the list of available macros and instructions on how to use them. You can also refer to the Сomplete list of macros page to get a list of all macros and their descriptions.

Note. Please note, the app supports a maximum of one nested level of macros. For instance, you can put a macro into another macro, e.g. ~%Macro[~%Macro], and this will work fine. But if you add a second nested level, e.g. ~%Macro[~%Macro[~%Macro]], we cannot guarantee the correct functioning of the tool.

Video: How to customize templates with macros

Find the full video transcript on the Webinar 2: Customize and personalize your templates page.

How to add macro to your template

To add a macro, take the following steps:

  1. Select an existing template or create a new one and click Edit:
    Edit template.
  2. In the text of the template, place the cursor where you want to put a macro, click the Insert Macro icon, and select the macro you want to use.

    For example, we select the InsertReipientFirstName macro that inserts the first name of the recipient:
    Select your macro.

    Now recipient's name will be pasted automatically each time we use this template:
    Template with macro.

Tip. In My templates you will find the Templates with macros folder. There is a list of macros, and when you click on a macro you can see its description and instruction on how to use it:
The list of macros.

What macros do and how to use them

Find the activity you'd like to implement and the corresponding macro you can use. If this is your first acquaintance with macros, we recommend that you read this section carefully and try out all the macros yourself to discover how they can simplify your emailing routine.

Tip. You can use nested macros as long as they do not exceed one nested level.
For example, feel free to create such macros as ~%FILLSUBJECT[~%DATE], ~%WHAT_TO_ENTER[~%INSERT_RECIPIENT_FIRSTNAME;~%TO], ~%ADDSUBJECT[Dear ~%INSERT_RECIPIENT_FULLNAME], etc.
Note. Please keep in mind that the entire macro text has to be of the same formatting, otherwise, the macro won't work. So, if your macro may have different formatting, select the entire macro text and clear formatting by clicking the Clear Formatting icon in the toolbar:

Fill in email fields: To, Cc, Bcc, Subject

Note. With all macros in this group, it doesn't matter where in the text of a template you insert a macro. These macros put the needed information into the email fields, you won't see them in the message body.
  • The FillTo, FillCc, FillBcc macros insert the specified email addresses (separated by semicolons) into the To, Cc, Bcc, fields accordingly. Any previously added addresses will be deleted.
  • The FillSubject macro inserts the specified text into the Subject field. Any previously added text in the Subject field will be deleted.
  • The AddTo, AddCc, AddBcc macros add the specified email addresses (separated by semicolons) to the To, Cc, Bcc fields accordingly. All the previously added addresses will be kept.
  • The AddSubject macro adds the item to the Subject field. The previously added to the Subject field text will be kept.

    Tip. By default, the macro adds text to the end of your Subject, so if you already have "Subject 1" in your Subject field and use ~%ADDSUBJECT[Subject 2], you'll get "Subject 1Subject 2".

    However, if you want the text to be added to the beginning of your Subject, you can use the ";{before}" element after your text in square brackets: ~%ADDSUBJECT[your text;{before}]

    So, to get "Subject 2Subject 1" in your Subject field, use the macro as follows: ~%ADDSUBJECT[Subject 2;{before}].

    Tip. When you use AddSubject, the utility doesn't add any separators or spaces between the inserted text units in the Subject field, so bear in mind to add a space or separator yourself.

    To use the macro, insert it into your template and replace "example@domain.com" with the necessary email address, in case of FillSubject/AddSubject replace "Text" with the necessary text.

    Examples of use:
    ~%FILLTO[example@domain.com]
    ~%FILLCC[example@domain.com]
    ~%FILLBCC[example@domain.com]
    ~%FILLSUBJECT[Text]

    ~%ADDTO[example@domain.com]
    ~%ADDCC[example@domain.com]
    ~%ADDBCC[example@domain.com]
    ~%ADDSUBJECT[Text]

Known issue. Please note that email addresses and text you insert must be of the same formatting as the text of the macro. If you copy an email address or text from some other resources or a web page, they will be pasted into a template in their original formatting, and the macro won't work. So, we recommend that you type in the needed text manually to avoid formatting problems.

How to attach files to emails with macros

  • To attach files, you can use the AttachFromOneDrive, AttachFromSharepoint, AttachFromURL, and WhatToAttach macros. Please see the detailed guide on the How to attach files to your templates page.

How to insert images into message body with macros

How to add information to message body

Add subject, date, time

Note. As these macros add information to the message body, make sure to put the cursor right to the place of a template where you want to see this information.
  • The Subject, Date, Time macros insert the content of the Subject field or the current date and current time into the message.

    Examples of use:
    If you have any questions regarding ~%SUBJECT, please let me know.
    This message is composed and sent on ~%DATE.
    This message is composed at ~%TIME.

Add addresses from To, Cc, Bcc fields

  • The To, Cc, Bcc macros insert the content of the To, Cc, or Bcc fields accordingly into the message.

    Examples of use:
    The information contained in this message is intended only for ~%TO.
    Please note, the copy of this message is sent to ~%CC.
    Please note, the copy of this message is sent to ~%BCC.

Insert recipient and sender names

  • The InsertRecipientFirstName, InsertRecipientFullName, InsertRecipientLastName macros insert the first, full, or last name of the recipient into a message if the name is displayed in the To field. Otherwise, the email address is inserted.

    Examples of use:
    Hi ~%INSERT_RECIPIENT_FIRSTNAME
    Dear ~%INSERT_RECIPIENT_FULLNAME
    Dear Mr. ~%INSERT_RECIPIENT_LASTNAME

  • The InsertSenderFirstName, InsertSenderFullName, InsertSenderLastName macros insert the first, full, or last name of the sender into a message.

    Examples of use:
    Warm regards, ~%INSERT_SENDER_FIRSTNAME
    Sincerely, ~%INSERT_SENDER_FULLNAME
    Best wishes, ~%INSERT_SENDER_LASTNAME

Paste profile and team properties

Enter text or pick date with WhatToEnter macro

  • The WhatToEnter macro prompts you to enter or pick text or date every time you insert a template into a message. You can type the text directly in the box, select from the drop-down list that is created from items you enter or pick a date in the drop-down calendar.

    When you select the macro to paste it into your template, a dialog window will appear where you pick Text field, Dropdown list, Date, or Dataset:

    ~%WHAT_TO_ENTER macro.

    • If you select Text field, you can enter a title for the window and a default value and click Insert:
      Text field.
      The macro in your template will look like this: ~%WHAT_TO_ENTER[10%;{title:"Discount"}].

    • When you choose Dropdown list, you'll have to enter a window title and several items for your list:

      Dropdown list.

      Besides, you can use two additional options:

      • Tick User can edit selected item(s) to make it possible to edit items in the drop-down list while pasting your template into a message.
      • Check User can select multiple items separated by to be able to select and insert several items into your email message; enter a separator that will divide these values.

      So, with the entered on the screenshot above values, the macro looks like this: ~%WHAT_TO_ENTER[10%;20%;30%;{title:"Discount",multiselect,editable,delimiter:", "}]

    • Pick Date if you'd want to enter a date into certain place in a message, and enter a window title:
      Pick Date.

      When you insert a template with this macro, you can pick a date in the drop-down calendar:
      Pick Date in a drop-down calendar.

    • To add values from a dataset to your template text, select Dataset. See the detailed manual on working with datasets on the How to create and use datasets page.
  • Note. When you insert a template that has several ~%WHAT_TO_ENTER macros in it, all the fields of these macros will be displayed in one window:
    All fields in one window.
    Note. If you click the Cancel button in the Fill in these fields window, the template insertion will be canceled.
    Tip. You can use the macro to insert the same value into different places of your message, see Tips and tricks for details.

Clear message body & check account

  • The ClearBody macro clears the message body when you insert a template into your message. So, if you may have some unneeded text in your message body, use this macro in your templates.
  • Pick FromAccount if you use shared mailboxes and want to make sure your messages are sent from the correct accounts. Into the square brackets, enter an Outlook account from which the email should be sent, e.g. ~%FROM_ACCOUNT[user@company.com]. While template inserting, the macro will check if the account in the From field is the same as the account you entered. If they differ, the template won't be pasted.

Add inner note to template

  • You can use the Note macro to leave an inner note in a template for you or your teammates. The macro does nothing to your message when you use a template that contains it, the macro is present only in the template. To use it, enter your note into the square brackets.

    Examples of use:
    ~%NOTE[Only for corporate customers]
    ~%NOTE[Contracts before 01.01.2020]

    In the preview mode, when you stand on the template, notes look like this:
    Closed note in the preview.

    To see the text of notes, simply click on them:
    Opened note in the preview.

Create meetings and appointments in Outlook Calendar

You can create appointments and schedule meetings with the help of templates and use the FillLocation, AddLocation, Location, FillSubject, AddSubject, AddTo, FillTo, AddCc, FillCc macros to fill in some fields.

See the detailed manual on the Use Shared Email Templates in Outlook Calendar page.

Сomplete list of macros

You can find the full list of all Shared Email Templates macros with syntax and examples on the Complete list of macros page.

Responses

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

Reply

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.

Reply

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

Thanks

Hello Patrick,

Good idea! I have just added it to our backlog. I will discuss with developers and definitely include it to the next build. Thank you.

Patrick,

Please ignore my previous comment.

You can use a WHAT_TO_ENTER macro with the same "window title". In this case, you will be prompted once. Plus, you can nest the WHAT_TO_ENTER macro into any *SUBJECT macro. Thank you.

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?

Reply

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.

Reply

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

Reply

Hello Giuseppe,

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

Reply
Luca Balbinot says:
January 26, 2021 at 5:27 pm

Hello Katerina, i have the same question as Giuseppe. Thank you.

Hello Luca,

Thank you for your question. Yes, it is possible to enter multiple items in the ~%WHAT_TO_ENTER macro choosing the Dropdown list option. Please find the detailed manual here: https://www.ablebits.com/docs/outlook-shared-templates-macros/#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 ?

Reply

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.

Reply
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?

Reply

Hello Vignas,

Thank you for your question.

If you'd like to quickly insert a unique hyperlink into an email depending on the context of your message, I'd recommend using the ~% WHAT_TO_ENTER[] macro in the combination with Dataset. I have just sent you the detailed instructions by email.

In case you have any questions or need further explanation, please do not hesitate to email back.

Reply

Ask a question (posted publicly)

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.