Opening a Microsoft Word documents can be extremly slow if the document uses a template (.dotx) which is no longer available. A tool like Word Template Corrector can automatically fix the template location of one or multiple Word (.docx) files.

Purchase Word Template Corrector as-is

The reason why the opening of Word documents is slow

When Microsoft Word opens one of your documents, it tries to load the referenced Word template which has been previously used. In most cases, the location and paths of the underlying Word templates do not change.

But sometimes it does:

  • Maybe you have stored the template locally on your hard disk and you have replaced the hard disk with another one. With replacing the hard disk, the drive names have also been changed (e. g. from D:\ to E:\).
  • In a corporate world, most of the Microsoft Word templates are centrally stored on a network drives which is either mounted locally or you are accessing the network drive by using the UNC name like \\your-server-ip-or-name.
    Due to networking restructuring, the IP address or network name can change.

As soon as the Word template is no longer available, Word tries to contact the old location. Due to the inner working of the operating system, accessing local templates it will fail relatively fast. But when a network share is used, it will take a long time. In the Microsoft Word’s status bar at the bottom, you can see the following error:

Contacting \\your-old-server-ip-or-name\my-share\my-template.dotx...

Circumventing the issue by reducing the timeout

A naive approach for circumventing the issue is to reduce Microsoft Word’s timeout when contacting the template path. The option is stored below the registry key

HKEY_CURRENT_USER\Software\Microsoft\Office\<Your version number>\Word\Options\UseTimeoutForAttachedTemplateLoad

It defaults to either 30 or 60 seconds, depending upon the used version of Word. If the registry key does not exist, you can it add a new DWORD value below the registry path. Set it to a low value like 3 or 1:

HKEY_CURRENT_USER\Software\Microsoft\Office\<Your version number>\Word\Options\UseTimeoutForAttachedTemplateLoad

In a corporate world, you can distribute the new key via a Group Policy.

That being said, the problem itself is not fixed: The location of the Word template is still wrong inside the Word document. For newer versions of Word, you have to always remember that the key UseTimeoutForAttachedTemplateLoad has to be configured.

Solving the issue by editing the Word document by hand

Did you know that newer Word documents with a .dotx ending are just ZIP files, mostly containing XML files in it? By the way: this is also true for .xlsx, .pptx files an so on.

You can open the corresponding .dotx file with a program like 7ZIP. Inside the ZIP file there is a file word/_rels/settings.xml.rels.

settiongs.xml.rels inside the Word document's ZIP archive

Extract the settings.xml.rels and replace the content of the attribute Target with the correct path:

Attribute "Target" inside settings.xml.rels

In the above example, for a UNC path on a network share you would set Target to “\\my-new-ip-or-hostname\Templates\Fixed-Letter.dotx”.

Save the setings.xml.rels file and replace the old file in the ZIP archive. When you open the Word document, it wil instantly load without contacting the old network share.

Solving it for thousands of documents

To be fair: Editing one document by hand might be okay. But in a corporate world you will most likely have thousands or hundred of thousands Word documents you have to fix. This is not be done by hand.

There are some solutions out there which make use of VBA macros. But these are methods which will fail due to the amount of files.

Because of that, say welcome to the Word Template Corrector (buy the binary or get the source) 🙂

Word Template Corrector

The Word Template Corrector is a command line tool which recursively iterates over a directory tree. Foreach found .docx file, the template path will be replaced with the correct one.

Usage

Word Template Corrector is a tool with one job so it is really easy to use it. After you have compiled the source code or bought the binary, open a command line and just execute the the following line:

wtc -d \\server\share\documents -o \\old-server\share\templates\ -n \\new-server\share\templates\ -r -t

The parameter -r searches recursively below the \\server\share\documents for docx files. For testing purposes, you can use the parameter -t which marks a dry run; no replacing occurs. After you have checked the output, you can execute the same command line but without the parameter -t.

A run of Word Template Corrector

You can find a complete list of parameters in the readme.md file.

Get Word Template Corrector

Word Template Corrector is open source. You can find the source code on GitHub with instructions how to compile it. If you have no knowledge about .NET, you maybe like to purchase a binary as-is:

Purchase Word Template Corrector as-is

I am asking you for a donation.

You liked the content or this article has helped and reduced the amount of time you have struggled with this issue? Please donate a few bucks so I can keep going with solving challenges.

Categories: Microsoft