The trick to Find or Replace web links in Word

Office for Mere Mortals
Your beginners guide to the secrets of Microsoft Office
Invalid email address
Tips and help for Word, Excel, PowerPoint and Outlook from Microsoft Office experts.  Give it a try. You can unsubscribe at any time.  Office for Mere Mortals has been running for over 20 years, we've never, ever revealed or sold subscriber details.  Privacy policy

Find or change many web links in Word documents using the Replace command, 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, not the text.

image 165 - The trick to Find or Replace web links in Word

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.

image 168 473x242 - The trick to Find or Replace web links in Word

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.

image 167 473x83 - The trick to Find or Replace web links in Word
“^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.

image 170 332x296 - The trick to Find or Replace web links in Word
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.

subs profile e1563205311409 - The trick to Find or Replace web links in Word
Latest news & secrets of Microsoft Office

Microsoft Office experts give you tips and help for Word, Excel, PowerPoint and Outlook.

Give it a try. You can unsubscribe at any time.  Office Watch has been running for over 20 years, we've never, ever revealed or sold subscriber details.  Privacy policy
Invalid email address