Breaking Links in Lots of Documents

by Allen Wyatt
(last updated May 21, 2016)


Ian has many, many documents that include links to other documents. (These are not hyperlinks; they are actual document links in Word.) He needs to break those links, and he knows that he can load the documents and break the links one by one. He wonders, though, if there is a macro available that could go through all the documents in a folder and automatically break all the links within those documents.

Manually, you can break links by following these steps:

  1. Click the File tab of the ribbon.
  2. Make sure that Info is selected at the left side of the screen.
  3. At the bottom-right side of the screen, under the Related Documents category, click Edit Links to Files. (If this option is not available, it means that Word doesn't think there are any links in the current document.) Word displays the Links dialog box. (See Figure 1.)
  4. Figure 1. The Links dialog box.

  5. Select the link you want to break.
  6. Click on Break Link. You are asked to confirm your action.
  7. Click on OK.

The steps are a bit different if you are using Word 2007:

  1. Click the Office button and then click Prepare.
  2. Click Edit Links to Files. (If this option is not available, it means that Word doesn't think there are any links in the current document.) Word displays the Links dialog box.
  3. Select the link you want to break.
  4. Click on Break Link. You are asked to confirm your action.
  5. Click on OK.

As you can tell, this process is rather labor intensive, particularly if you have lots of documents and each document has multiple links. The labor-intensive nature of the process is why Ian was searching for a way to break the links under control of a macro.

In order to do this in a macro, the macro needs to open each document in the folder, break any links it finds, and then save the document. Figuring out how many documents are in a folder, opening them, and closing them is rather straightforward. If you want to break the links, the macro needs to look through each field in the document and break only those that use the LINK field. The following macro shows how this is done.

Sub RemoveLinks()
    Dim fleArray() As String
    Dim flCount As Long
    Dim k As Long
    Dim fle As String
    Dim fld As Field
    Dim currentFileName As String
    Dim docPath As String
    Dim bDirty As Boolean

    docPath = ActiveDocument.Path & "\"
    currentFileName = ActiveDocument.Name

    fle = Dir(docPath & "*doc*")
    flCount = -1
    ReDim fleArray(0)
    Do While fle <> ""
        flCount = flCount + 1
        ReDim Preserve fleArray(flCount)
        fleArray(flCount) = fle
        fle = Dir()

    If MsgBox("There are " & flCount + 1 & " files to be processed." _
      & vbCrLf & "Do you want to continue?", vbYesNo, "Break links") _
      = vbNo Then Exit Sub

    For k = 0 To UBound(fleArray)
        fle = fleArray(k)
        Options.UpdateLinksAtOpen = False
        Documents.Open FileName:=docPath & fle
        Options.UpdateLinksAtOpen = True
        bDirty = False
        For Each fld In ActiveDocument.Fields
            If fld.Type = wdFieldLink Then
                ' Uncomment the following if link needs to be updated
                ' before the link is broken
                ' fld.LinkFormat.Update
                bDirty = True
            End If
        Next fld
        If bDirty Then ActiveDocument.Save    ' Only save if links broken
        If ActiveDocument.Name <> currentFileName Then ActiveDocument.Close
    Next k
End Sub

Notice the For Each loop that looks at each field (fld) in the Fields collection. It checks to make sure that the field's Type property is equal to wdFieldLink, which means it is a LINK field. If so, the code uses the BreakLink method with the LinkFormat property for the field, effectively removing the link.


If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (2357) applies to Microsoft Word 2007, 2010, 2013, and 2016.

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


Increasing the Size of the Draft Font

When looking at your document in Draft view, you may want Word to use a larger font than what it normally does. Here's ...

Discover More

Brackets around Footnote References

When you insert footnotes in a document, Word allows you to modify the formatting applied to the footnote references. ...

Discover More

Summing Only Positive Values

If you have a series of values and you want to get a total of just the values that meet a specific criteria, then you ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Saving All Open Documents

Got a lot of open documents you are working with? You can save them all at one time by adding a handy tool to your Quick ...

Discover More

Page Counts for Many Documents

Need to see the page count on a large number of documents? Windows provides an easy way to see the information you ...

Discover More

Opening Multiple Recent Files at the Same Time

The MRU provides a handy list of files you have recently used. Opening multiple files from the MRU, however, is no easy task!

Discover More

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

View most recent newsletter.


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 2 - 0?

2018-01-15 04:55:42



is there a way to remove links from the headers?
Because your vba code seems to work only for the plain text.

Thank you!

2016-05-23 07:49:37

Jerry Zachmann

Hi Allen, When I open the "Edit Links to Files" dialog box there are a couple dozen links to what looks like a temp file. Each time I open the document the filename changes but the _Ref#### items stay the same. What are these and should I get rid of them?

2016-05-21 22:28:39

Ken Endacott

A minor correction. The macro will attempt to open non Word files that have 'doc' in their title. To fix:

replace the line

fle = Dir(docPath & "*doc*")


fle = Dir(docPath & "*.doc*")

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

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.