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


Making the Show/Hide Setting Persistent

Word allows you to either display or hide non-printing characters that are in your document. This configuration setting ...

Discover More

Copying a File in VBA

Need to have your macro copy a file from one place to another? It's easy to do using the FileCopy command, described in ...

Discover More

ExcelTips: The Macros (Special Offer)

ExcelTips: The Macros is the definitive reference on how to use macros in Excel. You can stay at the top of your ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Managing Corporate Templates

Templates are used to store styles and lots of other customizations that affect how you use Word. On a single-user ...

Discover More

Editing a Template

Editing a template can be as easy as editing a regular Word document, provided you know where to find the templates. Here ...

Discover More

Creating a Document Based on a Template

Double-click a Word template file in Windows, and Word should create a brand new document based on that template. If this ...

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 one more than 0?

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.