• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1114
  • Last Modified:

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

Thanks

Centechs
0
CenTechs
Asked:
CenTechs
2 Solutions
 
PC-MasterCommented:

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?
0
 
CenTechsAuthor Commented:
It is specifically only with documents with this reference in them, I have narrowed down the problem beyond Word itself.

Thanks

Centechs
0
 
irudykCommented:
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)
0
 
GrahamSkanRetiredCommented:
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$()
    Loop
   
    'process files in current folder
    strFileName = Dir$(strFolder & "\" & strFilePattern)
    Do Until strFileName = ""
        DoEvents
        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
        Else
            doc.Close wdDoNotSaveChanges
        End If
        strFileName = Dir$()
    Loop
   
    'look through child folders
    For i = 0 To iFolderCount - 1
        ChangeAttachedTemplates strFolders(i), strFilePattern, OldAddress, NewAddress
    Next i
End Sub

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now