Word Document Calling For Non Existant Network Template

Hello Experts,

We are experiencing difficulty with some old documents that seem to have references to old template files that were located on a network share.  In Word 2007 when the files are opened everythni crashes and the application stops responding and takes ages to open these files.  Once open they are fine but the initial delay is making them unusable.  The broken link is apparent when you go into Word Options, Add Ins, Word Add Ins and then see the UNC path to the non existent file ie \\server\templates\template.dot in Templates and Add-Ins.

My question is, how can this be fixed?  In the past I have had to put a computer on the network containing these files with the same name as the old server to "fool" the system into thinking they are still there but is not ideal.  My other idea was to create a script that a user could run to remove any links to this from the document before opening it??

Any help is appreciated!!


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


The problem is only with old documents?

Whats happens when you open only the word you have the same problem?

And when you open the word in safe mode (pressing the ctrl button) still the same?
CenTechsAuthor Commented:
It is specifically only with documents with this reference in them, I have narrowed down the problem beyond Word itself.


Take a look at http://support.microsoft.com/kb/830561 for some options. In particular see Method 5 (http://support.microsoft.com/kb/830561#5)
You will have to open them even if only programaticlally.

This routine is designed to walk through a folder and its subfolders, opening document files and change the templates if necessary.

Note that for good performance it is better to re-instate the old server and the template structure until all the documents have been modified.
Sub ChangeTemplates()
    ChangeAttachedTemplates "C:\MyFolder", "*.doc*", "\\Oldserver\Templates\", "\\Newserver\Templates\"
End Sub

Sub ChangeAttachedTemplates(strFolder As String, strFilePattern As String, OldAddress As String, NewAddress As String)
    Dim strFileName As String
    Dim strFolders() As String
    Dim iFolderCount As Integer
    Dim i As Integer
    Dim doc As Document
    Dim strAttachedTemplate As String
    Dim strNewAttachedTemplate As String
    'collect child folders
    strFileName = Dir$(strFolder & "\", vbDirectory)
    Do Until strFileName = ""
        If (GetAttr(strFolder & "\" & strFileName) And vbDirectory) = vbDirectory Then
            If Left$(strFileName, 1) <> "." Then
                ReDim Preserve strFolders(iFolderCount)
                strFolders(iFolderCount) = strFolder & "\" & strFileName
                iFolderCount = iFolderCount + 1
            End If
        End If
        strFileName = Dir$()
    'process files in current folder
    strFileName = Dir$(strFolder & "\" & strFilePattern)
    Do Until strFileName = ""
        Set doc = Documents.Open(strFolder & "\" & strFileName)
        strAttachedTemplate = doc.AttachedTemplate
        If InStr(1, strAttachedTemplate, OldAddress, vbTextCompare) = 1 Then
            strNewAttachedTemplate = NewAddress & Mid$(strAttachedTemplate, Len(OldAddress) + 1)
            doc.AttachedTemplate = strNewAttachedTemplate
            doc.Close wdSaveChanges
            doc.Close wdDoNotSaveChanges
        End If
        strFileName = Dir$()
    'look through child folders
    For i = 0 To iFolderCount - 1
        ChangeAttachedTemplates strFolders(i), strFilePattern, OldAddress, NewAddress
    Next i
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.