How to use macros in your 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 tool 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 use macros in Shared Email Templates

How to add macro to your template

To add a macro, take the following steps:

  1. Open 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 ~%INSERT_RECIPIENT_FIRSTNAME 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.

  3. Click the Save button.
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. You can automatically fill in the To, CC, BCC, and Subject fields, as well as add information to the message body or get sender's or recipient's info pasted into your email.

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.

Video: How create templates with attached files

Attach files from URL or OneDrive

  • ~%ATTACH_FROM_URL[] attaches a file from the URL you specify. In the macro inserted into your template, replace "https://domain.com/file-url" with a link to the required file.
    Example: ~%ATTACH_FROM_URL[https://domain.com/file-url]

    Note. If you use the %ATTACH_FROM_URL[] macro in a template that is located in a team and shared with other users, make sure that your teammates have access to the URL you indicate in the macro.
  • ~%ATTACH_FROM_ONEDRIVE[] attaches a file from your OneDrive. When you pick this macro, the add-in will ask to log in to your OneDrive account and choose a file to attach:
    Select a file to attach from OneDrive.

    Note that when you use a template with this macro, you have to be logged in to OneDrive so that the macro has access to the file.

Attach files from Sharepoint

  • ~%ATTACH_FROM_SHAREPOINT[] attaches a file from your SharePoint. When you pick this macro, the add-in will ask to log in to your SharePoint account and choose a file to attach:
    Select a file to attach from SharePoint.

    Tip. You can switch to another SharePoint account by clicking the Switch SharePoint account icon on the right.

    Note that when you use a template with this macro, you have to be logged in to SharePoint so that the macro has access to the file.

    Note. If you use ~%ATTACH_FROM_SHAREPOINT[] in a template that is located in a team and shared with other users, make sure that your teammates have access to the file or folder in SharePoint. You can learn more about managing access in SharePoint on the Share SharePoint files or folders page.
    Note. Please note, the ~%ATTACH_FROM_SHAREPOINT[] will not work on free accounts, such as Outlook.com, as they do not have SharePoint.

Attach files from local storage

  • Use the ~%WHAT_TO_ATTACH macro to remind yourself to attach a file from your hard drive or SSD. If you insert the macro to your template, each time you use the template, the add-in will ask you to select a file. Click the Browse icon to pick it:
    Select a file to attach from local storage.

Insert image from OneDrive

  • ~%INSERT_PICTURE_FROM_ONEDRIVE[] inserts a picture from your OneDrive. When you pick this macro, the add-in will ask to log in to your OneDrive account and choose a picture to insert into your email:
    Select a picture to insert from OneDrive.

    Tip. You can switch to another OneDrive account by clicking the Blue Cloud icon on the right.

    You'll see the Insert picture window:
    Resize your image.

    If required, you can set the size of an image (in pixels) and click Insert.

    Note. If you use %ATTACH_FROM_ONEDRIVE[] or ~%INSERT_PICTURE_FROM_ONEDRIVE[] in a template that is located in a team and shared with other users, make sure that your teammates have access to the file or folder in OneDrive. You can learn more about managing access in OneDrive on the Share OneDrive files and folders page.
    Tip. For your convenience, you can create a special folder in your OneDrive, share it with all your teammates, and collect all the documents you share in templates there.
    Known issue. When you insert a template with ~%ATTACH_FROM_ONEDRIVE[] or ~%INSERT_PICTURE_FROM_ONEDRIVE[] macros, you'll have to sign in to your OneDrive account even if you are already signed in to the OneDrive app. This irritating situation happens because Microsoft guys still have not implemented the Single Sign-on feature for add-ins. Hopefully, this is a temporary problem and sooner or later Single Sign-on will be implemented.

Insert picture from URL

  • ~%INSERT_PICTURE_FROM_URL[] attaches and displays an image from the URL you indicate. When you select the macro, a dialog window will open. Enter your URL, set a size of a picture if you want, and click Insert:
    Resize your image.
    If you do not enter any size, the image will be inserted in its original dimensions.

    When you use a template with this macro, the macro downloads the chosen image, inserts a hidden attachment and displays it in the message body.

    Note. If you use the ~%INSERT_PICTURE_FROM_URL[] macro in a template that is shared with other users, make sure that your teammates have access to the URL you indicate in the macro.
    Tip. You can find more ways to insert an image into your templates on the How to insert pictures into your templates page.

Insert picture from SharePoint

  • ~%INSERT_PICTURE_FROM_SHAREPOINT[] inserts an image from your SharePoint. When you pick this macro, the add-in will ask to log in to your SharePoint account and choose a picture to insert into your email:

    Select a picture to insert from SharePoint.

    Tip. You can switch to another SharePoint account by clicking the Switch SharePoint account icon on the right.

    You'll see the Insert picture window:
    Resize your image.

    If required, you can set the size of an image (in pixels) and click Insert.

    Note. If you use ~%INSERT_PICTURE_FROM_SHAREPOINT[] in a template that is located in a team and shared with other users, make sure that your teammates have access to the file or folder in SharePoint. You can learn more about managing access in SharePoint on the Share SharePoint files or folders page.
    Note. Please note, the ~%INSERT_PICTURE_FROM_SHAREPOINT[] will not work on free accounts, such as Outlook.com, as they do not have SharePoint.

Add subject, date, time to the message body

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 contents 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.

Enter text with the ~%WHAT_TO_ENTER macro

  • The ~%WHAT_TO_ENTER macro prompts you to enter or select some text every time you insert a template into a message. You can type the text directly in the box or select from the drop-down list that is created from items you enter.

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

    ~%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.
      In this case, the macro in your template will look like this: ~%WHAT_TO_ENTER[10%;{title:"Discount"}].

      When you insert the template into your email message, a window with your title will appear and you can either leave the default value or enter any other:
      Enter your value.

    • 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:", "}]

      And when a template with such a macro is inserted into a message, the following window with a drop-down list appears:
      Select your items.

      If both additional options were checked, values from the drop-down list can be edited right in the window and multiple items can be chosen.

    Note. If you insert several ~%WHAT_TO_ENTER[] macros, you will have to fill in several boxes while pasting the template — a box per each macro.

Clear message body

  • 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.

Add an 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, by default, notes look like this:
    Closed note in the preview.

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

Add addresses from To, Cc, Bcc fields to message body

  • The ~%TO, ~%CC, ~%BCC macros insert the contents 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 to message body

  • The ~%INSERT_RECIPIENT_FIRSTNAME, ~%INSERT_RECIPIENT_FULLNAME, ~%INSERT_RECIPIENT_LASTNAME 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 ~%INSERT_SENDER_FIRSTNAME, ~%INSERT_SENDER_FULLNAME, ~%INSERT_SENDER_LASTNAME 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

Please refer to the How to use team & profile properties guide.

Сomplete list of macros

You can find the full list of all Shared Email Templates macros 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
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

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.