Creating Dynamic Links With MergeFields in Microsoft Word

Introduction

MergeFields allow users to import dynamic content in Microsoft Word. While this feature is very useful in many situations, it can be unclear how you must handle MergeFields nested inside of fields like hyperlinks. A user might want to have both dynamic link test and destinations for their hyperlinks. Unfortunately, how to achieve this is unclear because Hyperlink field codes only take a destination parameter. There is no place to put a merge field for your dynamic display text. In this article, I will show how to create fully dynamic links for Microsoft Word 2007 and up!

Step 1: Adding a Hyperlink Field

  • Put your cursor where you want to place the hyperlink
  • Go to Insert->Hyperlink
  • In the dialog box:
    • Next to Text to Display, enter something like “Temp Display Text”
    • Next to Address, enter something like “Temp Link”

You Should Now Have Something Like This:

KB_Step1

Step 2: Adding a Dynamic Destination Location

  • Press ALT+F9 to see the field code.
  • Delete the “Temp Link” text inside of the quotes.
  • If you have a base url location, enter it in between the quotes. Then proceed to the next step.
  • Now we must add a MergeField to get dynamic urls.
    • Put your cursor before the closing quote of your destination location.
      • Go to Insert-> Quick Parts-> Field.
      • Select MergeField from the Field Names menu.
      • Add the Field Name to identify the MergeField.
      • Click “OK” to exit the dialog.

You Should Now Have Something Like This:

KB_Step2

Step 3: Adding a Dynamic Link Text

  • Press ALT+F9 to hide the field code.
  • Delete the “Temp Display Text”  except for the last character.
  • Now we need to insert a MergeField.
    • Go to Insert-> Quick Parts-> Field.
    • Select MergeField from the Field Names menu.
    • Add the Field Name to identify the MergeField.
    • Click “OK” to exit the dialog.
  • Delete the last character of the temporary text.
  • If you did it correctly, you will still see a link mouseover when you hover over the link text MergeField.

You Should Now Have Something Like This:

KB_Step3

Conclusion

Now when you bind your data with MailMerge or WordWriter, your links will contain dynamic link text and destinations! Thanks for reading!

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *