Find and Replace links in Word documents

How to quickly change web links in Office documents.

It’s possible to bulk change web links in Word documents using the Replace, here’s the trick.

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 instead , not the text.

http://img.office-watch.com/ow/Word%20find%20field%20codes.png image from Find and Replace links in Word documents at Office-Watch.com

Now the { HYPERLINK …. } 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.

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.

http://img.office-watch.com/ow/Word%20find%20field%20codes%202.png image from Find and Replace links in Word documents at Office-Watch.com

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

That means 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.

Or ignore the ^d option just Replace strings that can only existing 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.

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.