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:
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:
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.
Extract the settings.xml.rels and replace the content of the attribute Target with the correct path:
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.
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.
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.
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
126.96.36.199 – Released on 2021-01-29
I’ve changed the default behavior of WTC to do an case-insensitive search of the string to be replaced. You can still enable a case-sensitive search by using the option
-c or --casesensitive.