Right-click on the field code and choose Edit Hyperlink.... In the Edit Hyperlink dialog, you can edit the "Text to display."
Hyperlink display text
When I toggle field codes on a hyperlink, I see only the target URL. For example, if I have some text "Click here to see examples" and I set the link to https://www.example.com/docs/2.0.0/examples/, I see "Click here to see examples" in the document, but when I toggle the field code I see { HYPERLINK "https://www.example.com/docs/2.0.0/examples/" }. How is the display text managed? I'm looking for something in the HYPERLINK field code so I can dynamically change the display text.
Microsoft 365 and Office | Word | For business | Windows
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
12 answers
Sort by: Most helpful
-
-
Charles Kenyon 160.1K Reputation points Volunteer Moderator2022-11-23T23:32:07+00:00 Normally, this must be done through the dialog. The display text disappears from the shown field code even though it is still there. In my experience, you can type new display text into the field and have that adopted. How that would be handled in a Replace, though, I do not know.
It may be possible to do this using vba; I expect so but have never tried.
Related threads:
-
Stefan Blom 325K Reputation points MVP Volunteer Moderator2022-11-24T01:26:44+00:00 The display text is the field result for the Hyperlink field. You can edit it in the Hyperlink dialog box but it is also possible to use VBA (Visual Basic for Applications) to manipulate the hyperlink display text.
-
Suzanne S Barnhill 275K Reputation points MVP Volunteer Moderator2022-11-24T02:16:34+00:00 You can use Replace to replace the display text provided the field code is not displayed. That's why it takes two passes to update a hyperlink, one to replace the display text (even if it is the same as the actual hyperlink target) and one to replace the hyperlink address.
-
Anonymous
2022-11-24T16:57:24+00:00 I know how to do it manually. What I'm looking for is a dynamic option, one where I can specify, in the HYPERLINK field code, what the display text is that goes with the link.