Skip to content

Two tricks to Find or Replace web links in Word

Find or change many web links in Word documents using the Replace command, here’s the two tricks – one is good and the other not so effective.

For example, you might need to change the domain name due a corporate restructure or update links so they are secure (https) instead of regular (http) links.

The trick is to reveal the links using the View Field Codes shortcut Alt + F9 that will display the underlying link, not the text.

Now the { HYPERLINK …. } field is visible, you can use standard Replace commands to make the changes. For example replace http with https (assuming there’s no ‘http’ references outside field codes).

Be careful with your Replace commands, keep in mind that:

  • There’s no way to limit Replace to just inside field codes
  • You can use the ^d special search term to find the start of a field, but it has limited value.
  • The field code markers { } can’t be used to either Find or Replace.

^d special search code

Using ^d will let you search inside a field to a limited extent. For starters you must have field codes visible (Alt + F9). That makes no sense since if you’re using ^d you’re clearly interested in the contents of field codes but that’s how Microsoft has done it, so we have to live with it.

A way to use ^d is to find certain types of field codes. For example ^d HYPERLINK will find the start of a field followed by a space and the field code HYPERLINK.

Ah ha, you think, I can use wildcards to do clever searches inside field codes. Sorry, Microsoft won’t let you. The ‘Use Wildcards’ option isn’t available with ^d search.

“^d is not a valid special characters for the Find What box or is not supported when the Use Wildcards check box is selected”

You have to be careful to ensure that your field codes have only the expected number of spaces between elements and parameters are always in the same order.

Search inside field codes

Usually the better way is to ignore the ^d option just Replace strings that can only exist within a field code. For example (with Use Wildcards on) find HYPERLINK*”http: will find any link fields that have http links regardless of the number of characters between the field code and the link parameter.

Search inside Word field codes with View Field Codes (Alt + F9) ON and Use Wildcards.

Use the same trick to find and change field code parameters globally.

After doing a field code Replace it’s a good idea to use Find and manually check the fields to make sure none were missed accidently.

About this author

Office Watch is the independent source of Microsoft Office news, tips and help since 1996. Don't miss our famous free newsletter.