I found this post on a Microsoft forum
here:
"By default, if you insert a mailmerge field into a hyperlink field, the hyperlinks will all show the first record’s address as the 'Text to display' text. Here's how you can do get a mailmerge to display your preferred default 'Text to display' text instead:
1. Disregarding mergefield issues for the moment, insert a hyperlink into the document in the normal way, choosing whatever 'Click Here' text you want in the 'Text to display' box.
2. Select the inserted hyperlink and press Shift-F9 to expose its field code.
3. Replace everything in the field after 'HYPERLINK' with your mergefield.
4. Select the field and press F9 to update the display.
In Word 2007 & later, you can make the display text variable also, by following these additional steps:
5. Position the cursor anywhere within the display text.
6. Insert a mergefield pointing to whatever data field you want to use for the display text (this could even be the same field as used at step 3 above).
7. Delete all of the previous display text either side of your last-inserted mergefield (note that this field will likely have updated already).
8. Execute the merge.
9. After merging to a new document, use Ctrl-A, F9 to update all fields. Without this, the mergefield hover text won’t update to the correct targets.
Now, as for implementing your IF tests along the foregoing lines, you should be able to use:
{HYPERLINK "{IF{MERGEFIELD M_CXdotLIBORTEST}= "N" "http://www.federalreserve.gov/releases/h15" "http://online.wsj.com/mdc/public/page/2_3020-moneyrate.html"}"}
for the hyperlink field code (step 3) and:
{IF{MERGEFIELD M_CXdotLIBORTEST}= "N" "Federal Reserve Statistical Release" "Wall Street Journal"}
for the display text (step 6), respectively. As you can see, the HYPERLINK field code reverses the arrangement you had, by putting the IF test inside the HYPERLINK field rather than the other way around; HYPERLINK fields inside IF tests will always come out as plain text."
I am having an issue with this code. For my link, it is either there in some cases, or not there in other cases. (If Variable='Y', the hyperlink exists), (If Variable!='Y', there is no hyperlink).
I have figured out how to have the correct hyperlink with the proper text- but when I complete the Mail Merge, the link is appearing in all cases (even when Variable!=Y) rather than just when Variable =Y.