Use Alt + F9 to Find and Replace URLs in Word
Last week I was working along merrily in Microsoft Word, using Find and Replace to change URLs in a document, until I realized that I was only changing the link's text... not the URL the link would go to when clicked. In Word, a link's text and its destination URL have to be changed separately if you are using Find and Replace!
I was worried I was going to have to start over and change each URL by hand, so I Googled up a solution: Alt + F9 is the keystroke to show Field Codes, including destination URLs. After hitting Alt + F9, the destination URL for each link was editable through Find and Replace.
Several Find and Replaces later, I hit Alt + F9 to toggle back to having the destination URLs hidden, and moused over my links to double-check that each link's text matched its destination. Success!
This does not change the target address of the link. It is true that this process changes what the hover text displays, and F9 field display text, but if you right-click on the link and actually view the hyperlink address, that remains unchanged. And clicking the link will still take you to the original location.
Posted by: April | 07/26/2011 at 10:31 AM
To make this solution work, after making the changes above, you need to select the fields (or Ctrl+A to select everything) and use F9 to update the fields with the change.
Posted by: April | 07/26/2011 at 11:23 AM
Using Alt + F9 *does* work to change the destination URL as described in the post. This is the exact procedure I used to generate the screen shots:
1. Create a Word 2007 document, type in the URL http://overdrivefaq.pbworks.com/ and let Word auto-insert a hyperlink with the same destination URL.
2. Hit Ctrl + F and do a Replace with the following criteria:
Find what: http://overdrivefaq.pbworks.com/
Replace with: http://dbooks.wplc.info/
(This step is described in the first paragraph of the post, and results in the mismatched link text and destination URL seen in the first screen shot.)
3. Hit Alt + F9 to show the destination URL. (This is illustrated in the second screen shot.)
4. Hit Ctrl + F and do a Replace with the following criteria:
Find what: http://overdrivefaq.pbworks.com/
Replace with: http://dbooks.wplc.info/
5. Hit Alt + F9 to toggle back to having the destination URL hidden. (This is illustrated in the third screen shot.) If you right-click and select "Edit Hyperlink," the URLs in "Text to display" and "Address" match.
Posted by: Rose | 07/26/2011 at 01:19 PM
This method didn't work for me either. However, the following marco did fix the problem for me:
Sub ReplaceHyperlinks()
Dim HL As Hyperlink
Dim target As String
Dim repl As String
target = InputBox("Find address", "Replace Hyperlink")
If Len(target) = 0 Then Exit Sub
repl = InputBox("Replace address", "Replace Hyperlink")
If Len(repl) = 0 Then Exit Sub
For Each HL In ActiveDocument.Hyperlinks
With HL
If InStr(LCase(.Address), LCase(target)) _
Or InStr(LCase(.TextToDisplay), LCase(target)) Then
.Address = Replace(.Address, target, repl)
.TextToDisplay = Replace(.TextToDisplay, target, repl)
.ScreenTip = Replace(.ScreenTip, target, repl)
.Range.Fields.Update
End If
End With
Next
End Sub
Posted by: Gerald | 02/15/2012 at 01:25 PM
April's method...
Alt+F9
global find/replace
ctrl-A and F9
... works PROVIDED you also change the hyperlink base to an appropriate target
(in my case, I used it to remove the absolute path and restore hyperlinks to relative links)
Posted by: Lance | 06/26/2012 at 10:41 PM
Rose's method worked perfectly for me. This fix saved me changing hundreds of links by hand. I'd switched a database to a new server, which spoiled the links, and Rose's tip--helpfully brought to my attention by a Santa Cruz geek, Jason Wehmhoener--was exactly what I needed. Thank you, Rose--and Jason!
Posted by: Mari Lynch - Fine Wordworking | 12/01/2012 at 05:23 PM
It didn't work for me quite verbatim from the original post, but the comments helped me bridge the gap. Here's what I did:
1. ALT+F9 (This makes all link previews visible inline.)
2. Find & Replace (CTRL+H) the sections that need replacing.
3. CTRL+A (Selects all text.)
4. F9 (This updates the actual links and their previews.)
5. ALT+F9 (This will right the document so that the URLs appear as clickable hyperlinks.)
Posted by: Sarah | 02/14/2013 at 12:52 PM
BTW Thank you for posting this! I couldn't find an answer anywhere else, and this helped me figure it out. Really appreciate you making this public.
Posted by: Sarah | 02/14/2013 at 12:53 PM
Thanks, Rose for the post and Sarah for the clarifying steps. This is perfect.
Posted by: Brent | 04/05/2013 at 11:07 AM
This was just what I needed. Thanks you!!
Posted by: jay | 04/22/2013 at 07:35 PM
worked great for me I just migrated a bunch of DFS storage and relative paths for documentation got screwed up.
Posted by: chris | 02/28/2014 at 03:52 PM
I tried the following steps and when I hover over the links, some showed the new urls and some do not, but the ALT + F9 displays the correct link. Please help!
1. ALT+F9 (This makes all link previews visible inline.)
2. Find & Replace (CTRL+H) the sections that need replacing.
3. CTRL+A (Selects all text.)
4. F9 (This updates the actual links and their previews.)
5. ALT+F9 (This will right the document so that the URLs appear as clickable hyperlinks.)
Posted by: MyJs | 05/12/2014 at 08:03 PM
This worked perfectly in Word 2013. Just saved me many hours of editing hundreds of links.
Posted by: Masroe | 07/22/2014 at 10:48 AM
thank you everybody!!!
you saved me with the f9 update!!!
Posted by: shira | 10/23/2014 at 05:55 AM
Nice posts.
Posted by: Stewart Fishman | 02/12/2015 at 11:17 AM
This is working perfect. A very useful Post.
Posted by: Suneet | 03/25/2015 at 12:45 AM