0

I am trying to figure out if it's possible to add multiple mergefields within a hyperlink. For example, when I try to use the following: {HYPERLINK "https:/wwww.myurl.com/billpay/amt={ MERGEFIELD ID * MERGEFORMAT} &PONumber={ MERGEFIELD ID * MERGEFORMAT}"} the result is: https://www.myurl.com/billpay/amt={ MERGEFIELD ID * MERGEFORMAT} &PONumber={ MERGEFIELD ID * MERGEFORMAT}.

I would like it to populate with https://www.myurl.com/billpay/amt=45.00&PONumber=1234800 .

I did refer to Add Variable Hyperlink in Mail Merge in Word 2013 but did not help in my case.

Any suggestions...?

Jae
  • 61
  • 2
  • 9
  • 1
    First off, delete the \\* MERGEFORMAT switches - they do nothing useful. A field coded as {HYPERLINK "https:/wwww.myurl.com/billpay/amt={MERGEFIELD ID}&PONumber={MERGEFIELD ID}"} is liable to display as https:/wwww.myurl.com/billpay/amt=«ID»&PONumber=«ID», which isn't particularly useful. Note that your construction has a space before & - mine does not. To address the display issue, see *Mailmerge Hyperlink ‘Click Here’ Insertion* in the **Mailmerge Tips and Tricks** page at https://www.msofficeforums.com/mail-merge/21803-mailmerge-tips-tricks.html. Otherwise, the field should work correctly. – macropod Apr 27 '21 at 10:19
  • It doesn't work....I took out the switches and spaces but the link ends up showing as https://www.myurl.com/billpay/amt={MERGEFIELD ID}&PONumber={MERGEFIELD ID} . I've also looked at the link you provided but doesn't have anything for embedding mergefields within hyperlinks. – Jae Apr 27 '21 at 19:57

2 Answers2

2

I got my hyperlinks with mergefields working in Microsoft 365 by simply having the mergefield-values in their own lines So instead of having the hyperlink block look like this

{HYPERLINK "https:/wwww.myurl.com/billpay/amt={ MERGEFIELD ID * MERGEFORMAT} &PONumber={ MERGEFIELD ID * MERGEFORMAT}"}

I divided it into more lines like this

{HYPERLINK "https:/wwww.myurl.com/billpay/amt=

{ MERGEFIELD ID}

&PONumber=

{ MERGEFIELD ID}"}

I did some back&forth testing and it seemed to be the difference between failure and success

  • This worked for me when attempting to generate a dynamic hyperlink in a Xero Invoice Template. Thanks! – Mark T Nov 02 '22 at 10:40
1
  1. Insert your two MERGEFIELDs into your document, such that you get:

«Amount»«ID»

Note: The field code representation you posted has {MERGEFIELD ID} twice, but the supposed hyperlink display refers to an amount for the first of these.

  1. Type between and either side of these so you get:

HYPERLINK "https:/wwww.myurl.com/billpay/amt=«Amount»&PONumber=«ID»"

3 Select the range and press Ctrl-F9, so you get:

{HYPERLINK "https:/wwww.myurl.com/billpay/amt=«Amount»&PONumber=«ID»"}

4 Press F9 to update the display. You should now see a hyperlink with:

https:/wwww.myurl.com/billpay/amt=«Amount»&PONumber=«ID»

5 Position the cursor anywhere within the display text and type whatever text you'd prefer to see (e.g. Payment Link), deleting any content either side of your preferred text. As per the Mailmerge Hyperlink ‘Click Here’ Insertion topic in the Mailmerge Tips and Tricks page at https://www.msofficeforums.com/mail-merge/21803-mailmerge-tips-tricks.html, you can even insert an actual mergefield into the Display text, if you desire.

Done.

macropod
  • 12,757
  • 2
  • 9
  • 21