Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Changing Many Link Locations.

Changing Many Link Locations

by Allen Wyatt
(last updated August 22, 2015)

11

In a corporate environment, documents are often kept on a network server. That server may not even be close to where you are—it may be across the country or around the world. If you are creating documents that include many graphics, it is common practice to only link to those graphics, and to store the graphics on a network server where they are accessible by everyone using the document.

What happens when the server changes, however? What if the company updates or moves a server, and in the process changes the address at which your graphics are accessed? When linking to graphics over a network, Word keeps track of the graphic's location using a UNC (Universal Naming Convention). If the UNC address of your graphics changes, you need to change the UNC used in the link. It is possible to do this one link at a time, but if you have many, many graphics in a document, this can be a major pain.

There is a quicker way to update the UNC address of a server, however. Let's say that you work for a company, and they change servers, thereby changing the UNC address at which your graphics are accessed. In examining the old and new addresses, you notice that the only thing that changed was the name of one server, from bcdapp to qcyapp. To change all the links in your document to reflect the new server name, follow these steps:

  1. Open the document in which you want to change the links.
  2. Change to Draft view. (If you are in Print Layout view, Word tries to repaginate quite often as you try to do the changes, and that makes this whole process much longer.)
  3. Press Alt+F9 so that field codes are showing. (Links are nothing but field codes, so the full field codes for each of your links should be visible.)
  4. Press Ctrl+H. Word displays the Replace tab of the Find and Replace dialog box. (See Figure 1.)
  5. Figure 1. The Replace tab of the Find and Replace dialog box.

  6. In the Find box, enter the portion of the link you want to change. In the example described above, you would enter bcdapp.
  7. In the Replace box, enter the new portion of the link. In the example described above, you would enter qcyapp.
  8. Click Replace All. Word replaces all the text within the exposed links.
  9. Close the Find and Replace dialog box.
  10. Press Alt+F9 so that field results are showing. (Your results still won't show properly until you do the next two steps.)
  11. Select the entire document by pressing Ctrl+A.
  12. Press F9. Word updates all the fields in the document, including those links you just changed.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10022) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Changing Many Link Locations.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Repeating Table Rows with Manual Page Breaks

Need to make sure part of a table is on one page and part on another? The way to do so is not to use manual page breaks, for ...

Discover More

Creating Page Footers and Headers

Headers and footers can add a final, professional touch to your printed document. Here's the quick way to add the headers and ...

Discover More

Uppercase and Lowercase AutoCorrect Entries

AutoCorrect can be a great tool to correct, automatically, the typos and wording you enter in a document. Sometimes, though, ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Linking to Slides in PowerPoint

If you are preparing a document that references a presentation you created in PowerPoint, you may want to reference in the ...

Discover More

Embedding an Excel Chart in a Word Document

Word and Excel usually work pretty well together. This means that you can easily paste charts from Excel into your Word ...

Discover More

Converting from Open Office to Word

If you have a number of documents in Open Office format, you may want to work with them in Word. There are several ways that ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 0 + 6?

2017-09-27 11:16:59

Eduard

Exactly what I was searching for! Thanks a lot.


2017-06-21 06:01:33

Vilmar Monteiro

Thanks a lot for this tip! I just find the answer just here.


2017-05-10 04:53:45

LIZA-MARI

THANK YOU, I WAS SCARED I WAS GOING TO MANUALLY HAVE TO UPDATE ALL THE LINKS IN THE DOCUMENT, THIS TIP REALLY SAVED ME TIME


2017-03-26 18:26:10

ASHRAF RAHMANI

Thank you so much for your tip. It helped me a lot to change all hyperlinks of the file I converted from html into word.


2016-11-07 10:04:16

DuncanPT

Fred's macro is good but deals with hyperlinks and not OLE links between Office applications.
To modify it for file links, the variable HL will need to be declared as "Field" and the loop will become
For each HL in ActiveDocument.Fields

You'll probably also need to confirm that each field is a LINK type (.Type = wdFieldLink) before acting on it.


2016-10-10 16:30:40

Fred

Updated macro. The previous version required an exact case match. This version uses the VBTextCompare parameter to allow upper or lower case to be matched.

Copy and paste macro below
--------------------------
Sub ReplaceHyperlinks()
Dim HL As Hyperlink
Dim sFind As String
Dim sRepl As String
Dim iCnt As Integer

sFind = InputBox("Find what", "Find Hyperlink")
If Len(sFind) = 0 Then Exit Sub
sRepl = InputBox("Replace with", "Replace Hyperlink")
If Len(sRepl) = 0 Then Exit Sub
iCnt = 0
For Each HL In ActiveDocument.Hyperlinks
With HL
If InStr(LCase(.Address), LCase(sFind)) Then
.Address = Replace(.Address, sFind, sRepl, , , vbTextCompare)
.ScreenTip = Replace(.ScreenTip, sFind, sRepl, , , vbTextCompare)
.Range.Fields.Update
iCnt = iCnt + 1
End If
If InStr(LCase(.TextToDisplay), LCase(sFind)) Then
.TextToDisplay = Replace(.TextToDisplay, sFind, sRepl, , , vbTextCompare)
.Range.Fields.Update
End If
End With
Next
MsgBox ("Links replaced: " & iCnt)
End Sub


2016-10-04 16:18:20

Fred

The problem with the above solution is that it does not replace the Screen Tip popup when you hover over the link.

This macro will replace everything in the link with the replace text.

How to copy this macro into Word
1. Run Word
2. Turn on the Developer tab: Office button, Word options, Popular, check Show Developer tab in the

Ribbon, OK
3. Click Developer, Visual Basic
4. Click Normal
5. Insert, Module
6. Copy and paste the below macro into the Normal - Module1 window
7. File, Save Normal, close Visual Basic window
8. To Run the macro, click Developer, Macros, ReplaceHyperlinks

The macro should be stored in the Normal.dotm template here: C:Users[username]AppDataRoaming

MicrosoftTemplates

Copy and paste macro below
--------------------------
Sub ReplaceHyperlinks()
Dim HL As Hyperlink
Dim sFind As String
Dim sRepl As String
Dim iCnt As Integer

sFind = InputBox("Find what", "Find Hyperlink")
If Len(sFind) = 0 Then Exit Sub
sRepl = InputBox("Replace with", "Replace Hyperlink")
If Len(sRepl) = 0 Then Exit Sub
iCnt = 0
For Each HL In ActiveDocument.Hyperlinks
With HL
If InStr(LCase(.Address), LCase(sFind)) Then
.Address = Replace(.Address, sFind, sRepl)
.ScreenTip = Replace(.ScreenTip, sFind, sRepl)
.Range.Fields.Update
iCnt = iCnt + 1
End If
If InStr(LCase(.TextToDisplay), LCase(sFind)) Then
.TextToDisplay = Replace(.TextToDisplay, sFind, sRepl)
.Range.Fields.Update
End If
End With
Next
MsgBox ("Links replaced: " & iCnt)
End Sub


2016-09-01 09:13:44

Chirag

Thanks!

This saved my few minutes


2016-07-19 15:56:36

LoveToFormat

In response to:

Pär 22 Jun 2016, 06:39
Hi.
Is it possible to get this link changing depending on source folder name?
I have a Word document and a excel dokument in a folder called customer.
I would like to, when i copy the folder customer end past it in, rename it to "customer x", that the links works between the Word document and excel document IN this folder "customer x".

Any tip?
/
Pär




This is definitely possible if you change the location of the source file or even if you change the name of the source file. All you need to do is, select the file tab at the top of the source file which displays the information page for the source file. Just under where it says "Information about (source file name)" you can select the file location. This will be what you enter into the replace field. Please note that when I did this, my field codes showed a double \ for my links but the source file location only had 1 . To make this find and replace work, I just added an additional to the location and it worked perfectly. Good luck!


2016-06-22 06:39:23

Pär

Hi.
Is it possible to get this link changing depending on source folder name?
I have a Word document and a excel dokument in a folder called customer.
I would like to, when i copy the folder customer end past it in, rename it to "customer x", that the links works between the Word document and excel document IN this folder "customer x".

Any tip?
/
Pär


2016-01-20 00:59:31

Simon Powell

Is there a way to do this in Publisher 2010?


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.