Embedding Linked Documents

Written by Allen Wyatt (last updated January 3, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


Jennifer has a Word document that has links to hundreds of other documents. Now she wants to replace each of those links with the actual document referenced. (In other words, she wants to embed the referenced documents.) She wonders if there is a global way to do this instead of having to do each document separately.

The solution depends on how, exactly, you have the other documents linked to your current document. If you inserted the contents of another file using the Text from File command (Insert tab | Object | Text from File) and chose to insert as a link, then the file contents are actually added through the use of the INCLUDETEXT field. As with any other field, you can unlink the field in this manner:

  1. Select the field. (Or, if you have lots of fields, press Ctrl+A to select the entire document.)
  2. Press Ctrl+Shift+F9. Word unlinks the fields, leaving the text that the fields represented.

If your documents are linked using hyperlinks, then the process is a bit more difficult. The reason is simple: a hyperlink is only a pointer to the other document, not the actual contents of that other document. This means that you need to come up with a way to open the other document, grab its contents, and stuff it into the current document in place of the hyperlink.

This type of work is perfect for a macro to do. The following example actually steps backwards through each hyperlink and inserts the files:

Sub InsertDocs()
    Dim aRange As Range
    Dim J As Long

    Set aRange = ActiveDocument.Range
    ' Go backwards because hyperlinks are deleted as processed
    For J = aRange.Hyperlinks.Count to 1 Step -1
        With aRange.Hyperlinks(J)
            ' Process only hyperlinks to documents
            If InStr(.Address, ".doc") > 0 Then
                .Range.Select
                On Error GoTo noFile
                .Follow
                On Error GoTo 0
                ActiveDocument.Range.Copy
                ActiveDocument.Close
                Selection.Paste
            End If
            GoTo nextFile
noFile:
            On Error GoTo 0
            MsgBox "Cannot open file " & .Address
nextFile:
        End With
    Next J
End Sub

Note that the macro checks the hyperlink to make sure it contains the letters ".doc". This doesn't mean that it is limited only to the old .DOC files, as the test would also match the letters ".docx" and ".docm".

Note:

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 (6824) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365.

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

AutoCorrecting for Your Common Errors

AutoCorrect is a great way to correct your spelling, particularly if you misspell the same words over and over. Here's a ...

Discover More

Duplex by Default

Many printers these days have the capability to print on both sides of a piece of paper. You may want Word to use this ...

Discover More

Making Custom Heading Styles Appear in the Navigation Pane

Creating styles for your documents is a powerful way to format them. How do you get paragraphs formatting with those ...

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)

Making Live URLs Into Normal Text

Convert those URLs into regular text! It's easy to do when you follow the steps in this tip.

Discover More

Pop-up Windows in Word

Want to add a small pop-up window over a word in your document? There is no way to do this directly in Word, but you can ...

Discover More

Updating Document Links

If you establish dynamic links between documents, then you can force Word to update those links whenever you want. How ...

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}] (all 7 characters, in the sequence shown) 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 six minus 4?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.

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