Using Documents after a Server Move

Written by Allen Wyatt (last updated July 16, 2022)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021

Francisco's company recently moved their shared templates from one server to another. Now, they can no longer open any documents that were created in the past that referenced the old template location. When they try to open the document they get the Word splash screen and then it gets stuck on connecting to the old location where the templates used to be. Francisco wonders how they can use their old documents if they cannot even open them.

There are a couple of approaches you can use for a problem such as this. If the template location on the old server was accessed through a mapped drive in Windows, then you may be able to simply re-map the drive to the new location. For instance, if the old template location was mapped to drive Z:, just break the mapping connection in Windows and re-map drive Z: to the new server location. If you are able to do this, then your Word documents should just open directly, as the location mapping is handled completely by Windows.

If, however, your templates were accessed using a UNC path instead of a mapped drive, then you may want to see if your IT folks can either set up the older server until you can open your documents and change the template location within the documents, or perhaps they can create an "alias" on the new server that looks, to your connected machines, as if the old server's path is now on the new server. (Setting up an alias is similar to mapping a drive in Windows, except it is done on the actual server.)

If you want, you can try using a macro to access the documents and change the attached template to something that is accessible from the computer. The following can be thought of as a good starting place for such a macro.

Sub FixDocs()
    Dim sDocRoot As String
    Dim sNewTemplate As String
    Dim sUserTemplates As String
    Dim sWorkgroupTemplates As String
    Dim sFile As String
    Dim sAbsFile As String
    Dim sAbsTemplate As String
    Dim sOldTemplate As String
    Dim d As Document
    Dim sMsg As String
    Dim sTemp As String

    sDocRoot = "c:\path\to\documents\"
    sNewTemplate = "c:\absolute\location\of\new\template\Normal.dotm"

    With Application.Options
        sWorkgroupTemplates = .DefaultFilePath(wdWorkgroupTemplatesPath)
        sUserTemplates = .DefaultFilePath(wdUserTemplatesPath)
    End With

    sFile = Dir(sDocRoot & "*.docx")

    Do While Len(sFile) > 0
        sAbsFile = sDocRoot & sFile
        Set d = Documents.Open(sAbsFile)
        sOldTemplate = d.AttachedTemplate

        sMsg = sMsg & "Document Name          = " & sFile & vbCrLf
        sMsg = sMsg & "Absolute Document Name = " & sAbsFile & vbCrLf
        sMsg = sMsg & "Attached Template      = " & sOldTemplate & vbCrLf

        sTemp = "Old template (" & sOldTemplate & ") found in "
        sAbsTemplate = sWorkgroupTemplates & "\" & sOldTemplate
        If IsFile(sAbsTemplate) Then
            sTemp = sTemp & "workgroups template directory"
            sAbsTemplate = sUserTemplates & "\" & sOldTemplate
            If IsFile(sAbsTemplate) Then
                sTemp = sTemp & "user templates directory"
                sTemp = "Old template (" & sOldTemplate & ") not found"
            End If
        End If
        sMsg = sMsg & sTemp & vbCrLf

        If sAbsTemplate <> sNewTemplate Then
            d.AttachedTemplate = sNewTemplate
            d.Close SaveChanges:=wdSaveChanges
            sMsg = sMsg & "Document updated" & vbCrLf
            d.Close SaveChanges:=wdDoNotSaveChanges
            sMsg = sMsg & "Document not updated" & vbCrLf
        End If

        Set d = Nothing
        sMsg = sMsg & vbCrLf
        sFile = Dir
    MsgBox sMsg
End Sub
Function IsFile(ByRef fName As String) As Boolean
    'Returns TRUE if the provided name points to an existing file
    'Returns FALSE if not existing, or if it's a folder

    On Error Resume Next
    IsFile = ((GetAttr(fName) And vbDirectory) <> vbDirectory)
End Function

To use the macro, you'll want to change the path assigned to sDocRoot; it should be the directory (with the trailing backslash) where your documents are located. Then, change sNewTemplate so it is the complete path to the new template you want to use.

The macro steps through each document in the sDocRoot directory, opens it, checks if the old template is in either the workgroup templates or user templates directory, and then changes the attached template to the new template if it wasn't already attached.

One thing you'll definitely want to do before using this macro is to backup all the documents you want to process. It may take a bit of trial and error to make sure that everything gets changed to what you need, but the "audit trail" that is compiled in the sMsg variable will be helpful in that regard. The macro displays the results when completed, but you can always change the macro to save the results in a brand new document so you can have a permanent record of what was done.

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

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


Forcing Stubborn Recalculation

Have you ever recalculated a worksheet, only to notice that not everything calculated as it should? Here's a way you can ...

Discover More

Jumping to the Start of the Next Data Entry Row

Want a quick way to jump to the end of your data entry area in a worksheet? The macro in this tip makes quick work of the ...

Discover More

How Word Applies Styles

Styles are a great boon for applying styles in a powerfully consistent manner. How Word applies styles, however, depends ...

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)

Inconsistent Prompting to Save Normal Template Changes

You can configure Word to notify you when it is about to save updates to the Normal template. There may be some ...

Discover More

Understanding Templates

Templates are used to store a pattern for how a document should look. As such, they can be a very powerful tool for ...

Discover More

Create a Template that Stops Styles from Being Added to a Document

Limiting which styles a user can use or add to a document can be a tricky task. Fortunately, Word has advanced to the ...

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}] (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 four more than 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.


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.