• doc looks for template at old location

    Author
    Topic
    #483862

    I have upgraded an old windows 2000 PC to a newer PC with Windows XP in a small business office that I provide support for. The PC acts as a file server for 4 other PCs in the office running Office 2003 under Windows XP. There are a lot of custom templates used to generate most documents. Normal.dot is hardly used.
    Since installing the new server, there is a noticible pause as each document is opened. watching closely in the lower left corner of the Word window, I see that Word is searching for the template at the old server location.
    Is there any way to configure something that tells the opening documents to look for the template at the new server location?
    When I transfer a file to my office computer with Office 2010(another physical location), I notice a similar phenomenon. The document, before opening, is looking for the original template that it was based upon.
    Thank you for some help

    Viewing 4 reply threads
    Author
    Replies
    • #1337050

      Do you have a template with the same name in your User Templates folder?

      • #1337271

        All of the custom templates are stored in folders on the server whose location is specified by the workgroup template location found under file locations. The normal.dot template is never used unless someone is lazy. I do not use the user templates folder location.
        I configured the new server computer with the same folder name layout as the original PC had. When I turned the new server online, I merely changed the machine network name of the mapped network drive and Word was directed to the new server.
        I discovered that when I turned the old server back on, the searching messages did not appear in the Word window. I cannot leave the original server on as it is going to fail soon.

    • #1337064

      When I am sending a document based on a template other than normal I will often attach it to the normal template prior to sending. I always keep the option to update styles from the template turned off. I recorded a macro to do this.

      If you have staff in need of a project, you could assign them the task of updating your old documents files.

      If you are using old documents as source material to create new documents instead of templates, this is one of the prices you eventually pay.

      • #1337067

        I faced this problem some years ago when the the template location was arbitrarily shut down by management. I had to research and cobble together a complex structure to handle this. It involves an event handler that is started whenever Word opens. One of several things it does is to check the name of the template that the document was originally based on. It then remaps the filepath to that template in its new location. I worked on XP and Office 2003.

        A note: in my new job, where we have Win 7 and Office 2012, I am discovering that this event handler (which also does other things) CAN read the name of the original template with pre2007 Word files but can NOT read this info with Word files created with Word 2007 or 2012. This even though the information is there in the XML metadata! (I have a thread about that over in the VBA forum).

        In more detail: an autoexec creates the event handler. The event handler determines the name & filepath of the original template and if this is not the “current template” then calls a routine with a long list of CASE tests, each one of which is a template name. For each Case, the file gets remapped to the new workgroup template location.

        Is this enough info for you to understand the structure?

        • #1337274

          to Stylus:
          Thank you for the insights. I believe that you are suggesting the solution means writing a VBA macro.
          I started using Word 2000 and prided myself by keeping up with reading everything I could find about Word. At that time and since I have been preaching the benefits of Templates and Styles. I cannot recall seeing any references to this Word hiccup though but for the last few years I have shifted my focus to other applications. I guess that is why I have missed this one.
          Could you provide a link to your thread in the VBA forum.
          Thanks again

    • #1337286

      I don’t have that many posts – a quick search will find you the thread. However, I didn’t go into any detail so there’s not much point in reading it.

      My current global template runs lots and lots of macros, partly because I built it for Word 2007 which offered no way of customizing the ribbon. If you have little experiences with VBA then my solution may be a bit much.

      I recall years ago reading someone describe how they had run a macro that plowed through all the files in a collection and changed the workgroup template filepath in all of them. There may have been a macro posted, so you could Google for it. The advantage for you would be that it would be a one-time operation that would hopefully solve your problem without ongoing macro functions. (The reason I didn’t use that approach when I faced the changed-location scenario was that the affected files were spread all over the place, including users’ individual drives. A real mess.)

      As for “this” Word hiccup… I doubt that any one person knows all the Word gochas!

      By the way, when the old server goes to the eternal cloud in the sky, can you rename the new server with the old server’s name? You could replicate the entire filepath of the Workgroup Templates location that is stored in each Word file, and that might solve your problem.

    • #1337876

      I’ve had the same problem and found there are a couple of ways to deal with it.

      Easiest way is to do as Stylus suggests – make sure the new server and path name’s are identical to the old one.

      The second is to remove the “Document Template” name from the “Templates and Add-ins” dialog box. In older versions of windows this was found under “Tools, Options, Templates and Add-ins?” (sorry, I’m guessing the last part). In 2007 and 2010 it’s under “Developer, Add-Ins”. (See attached)

      Open the template, and delete the info that’s in blue next to Attach… (it will be highlighted) then resave it. I set up an autonew macro to do this automatically.

      31303-Document-Template

      • #1337973

        BigMac56

        When you remove the document template name in that dialog box, doesn’t Word simply replace it with “Normal”?

        That’s been my experience, and was the reason that I had to construct the elaborate macro remapping structure years ago.

        • #1337997

          Hi Stylus,

          Yes it does replace the path and template name with normal, but that’s always local, so it solves the problem that Macdonell had of it taking a minute to open while it searched for the old path/template.

          As long as there’s no reason to stay attached to the original template it solves the problem.

          Our office has hundreds of templates, so the best solution for us was to keep the same server and path name, as we did last year. Unfortunately we didn’t do this when we upgraded the server in 2002, so there were a few older templates popping up that slowed things down, hence the 2nd solution.

          • #1338029

            BigMac56

            Macdonell didn’t tell us why he wanted to remap to the original templates. There could be content that Macdonell’s docs depend on. I found that templates from Word 2003 make styles available to the doc, yet if the pathway to the template is cut, then the doc only has those styles that have already been used in the doc. The remaining styles are out of reach. There is other content like that, for example auto text.

            That is the reason I had to get knee-deep in macros when I faced a similar problem.

            • #1338071

              You’re right Stylus,

              Our templates were fairly simple, no macro’s to worry about. The employee’s didn’t want to re-enter the customer information, so they just opened an old document, made a couple of changes and resaved it under a new name. This caused enough headaches when they forgot to change the name and overwrote the old document.

              Thanks for the clarification. 🙂

      • #1415064

        The second is to remove the “Document Template” name from the “Templates and Add-ins” dialog box. In older versions of windows this was found under “Tools, Options, Templates and Add-ins?”

        A BIG THANK YOU! I had a totally different problem, but I think this may have finally fixed it.

        Running Office 2000 under Windows Vista: Excel crashes usually when opening certain files; finally ran the ORK toolkit to fix it; that problem seemed to have been fixed, but the fix removed custom toolbars, menus, styles, etc., from both Excel and Word. Played heck trying to recover everything. Final problem was issues with normal.dot.

        Your post caused me to look at Templates and Add-Ins and, guess what, there were two normal.dot files loaded: The one I had been “fixing”, which was under “User” in the WordStartup folder PLUS a second one I hadn’t known about under “Program Files” in the OfficeStartup folder!

        I unchecked that one’s box in Word; closed Word; went to the OfficeStartup folder; renamed that one from “normal.dot” to “normal–read only.dot” and made it read-only; and created a subfolder there “Removed” and moved it down a level into the new subfolder (hiding it without losing it!).

        It doesn’t show up in Word at all now so, fingers crossed! :rolleyes:

        THANKS!!

        • #1415087

          A BIG THANK YOU! I had a totally different problem, but I think this may have finally fixed it.

          Running Office 2000 under Windows Vista: Excel crashes usually when opening certain files; finally ran the ORK toolkit to fix it; that problem seemed to have been fixed, but the fix removed custom toolbars, menus, styles, etc., from both Excel and Word. Played heck trying to recover everything. Final problem was issues with normal.dot.

          Your post caused me to look at Templates and Add-Ins and, guess what, there were two normal.dot files loaded: The one I had been “fixing”, which was under “User” in the WordStartup folder PLUS a second one I hadn’t known about under “Program Files” in the OfficeStartup folder!

          I unchecked that one’s box in Word; closed Word; went to the OfficeStartup folder; renamed that one from “normal.dot” to “normal–read only.dot” and made it read-only; and created a subfolder there “Removed” and moved it down a level into the new subfolder (hiding it without losing it!).

          It doesn’t show up in Word at all now so, fingers crossed! :rolleyes:

          THANKS!!

          There should be NO file named normal.dot (or normal.dotm) in any Word Startup Folder. This is a personal file, one for each user, in the user templates folder. The Startup Folder is for Add-Ins, not for the normal template.

          Templates in Microsoft Word

          Startup Folder in Microsoft Word

    • #1415150

      I’m sure I’ve posted the following before, but I can’t find it right now:

      When templates other than Word’s Normal template are used to create a document, the template’s path & name are stored with the document. If that path is a network path, a change to the server name will break the link. The result can be significant delays in opening the documents on the new server. See: http://support.microsoft.com/?kbid=830561. The same effect occurs when the file is opened on a computer attached to a different network. The following macro can be used to update the template paths or, if a new template path can’t be found, to point it to Word’s Normal template. Code is included to restore the original date/time stamps of the updated files.
      In the code, simply replace however much of the old & new template paths differ in the variables ‘OldServer, and ‘NewServer’.

      Code:
      Option Explicit
      '
      Dim FSO As Object 'a FileSystemObject
      Dim oFolder As Object 'the folder object
      Dim oSubFolder As Object 'the subfolders collection
      Dim oFiles As Object 'the files object
      Dim i As Long, j As Long
      '
      Sub Main()
      ' Minimise screen flickering
      Application.ScreenUpdating = False
      Dim StrFolder As String
      ' Browse for the starting folder
      StrFolder = GetTopFolder
      If StrFolder = "" Then Exit Sub
      i = 0: j = 0
      ' Search the top-level folder
      Call GetFolder(StrFolder & "")
      ' Search the subfolders for more files
      Call SearchSubFolders(StrFolder)
      ' Return control of status bar to Word
      Application.StatusBar = ""
      ' Restore screen updating
      Application.ScreenUpdating = True
      MsgBox i & " of " & j & " files updated.", vbOKOnly
      End Sub
      '
      Function GetTopFolder() As String
      GetTopFolder = ""
      Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
      If (Not oFolder Is Nothing) Then GetTopFolder = oFolder.Items.Item.Path
      Set oFolder = Nothing
      End Function
      '
      Sub SearchSubFolders(strStartPath As String)
      If FSO Is Nothing Then Set FSO = CreateObject("Scripting.FileSystemObject")
      Set oFolder = FSO.GetFolder(strStartPath)
      Set oSubFolder = oFolder.subfolders
      For Each oFolder In oSubFolder
        Set oFiles = oFolder.Files
        ' Search the current folder
        Call GetFolder(oFolder.Path & "")
        ' Call ourself to see if there are subfolders below
        Call SearchSubFolders(oFolder.Path)
      Next
      Set FSO = Nothing
      End Sub
      '
      Sub GetFolder(StrFolder As String)
      Dim strFile As String
      strFile = Dir(StrFolder & "*.doc")
      ' Process the files in the folder
      While strFile  ""
        ' Update the status bar is just to let us know where we are
        Application.StatusBar = StrFolder & strFile
        Call UpdateTemplateRefs(StrFolder & strFile)
        strFile = Dir()
      Wend
      End Sub
      '
      Sub UpdateTemplateRefs(strDoc As String)
      ' This sub updates the template paths for files after a server
      ' change. Simply insert however much of the lower end of the
      ' server paths differ as the OldServer and NewServer variables.
      Dim OldServer As String, NewServer As String, strPath As String
      Dim oItem As Object, StrDtTm As String
      OldServer = "\TSBVOL1": NewServer = "\TSLSERVERFiles"
      ' Store the file's current Date/Time stamp.
      If FSO Is Nothing Then Set FSO = CreateObject("Scripting.FileSystemObject")
      Set oItem = FSO.GetFile(strDoc)
      StrDtTm = oItem.DateLastModified
      ' Open the document
      Documents.Open strDoc, AddToRecentFiles:=False, ReadOnly:=False, Format:=wdOpenFormatAuto
      With ActiveDocument
        If .ProtectionType = wdNoProtection Then
          ' Update the template path
          strPath = Dialogs(wdDialogToolsTemplates).Template
          If LCase(Left(strPath, Len(OldServer))) = LCase(OldServer) Then
            ' Update the file counter for changed files
            i = i + 1
            ' Get the new template path & name
            strPath = NewServer & Mid(strPath, Len(OldServer) + 1)
            ' Check whether the template exists
            If Dir(strPath)  "" Then
              ' If found, update the path
              .AttachedTemplate = NewServer & Mid(strPath, Len(OldServer) + 1)
            Else
              ' If not found, reset the template to 'Normal'
              .AttachedTemplate = ""
              ' Output an error report in the document from which the macro is run.
              ThisDocument.Range.InsertAfter vbCr & "Template: " & strPath & " not found for " & strDoc
            End If
          End If
        Else
          ' Output a 'protected' file report in the document from which the macro is run.
          ThisDocument.Range.InsertAfter vbCr & strDoc & " protected. Not updated."
        End If
        .Close SaveChanges:=True
      End With
      ' Update the main file counter
      j = j + 1
      ' Let Word do its housekeeping
      DoEvents
      ' Reset the file's Date/Time stamp.
      Set oItem = FSO.GetFile(strDoc)
      If oItem.DateLastModified  StrDtTm Then oItem.DateLastModified = StrDtTm
      Set oItem = Nothing
      End Sub

      You can determine how much of the old & new template paths differ, for the purposes of the ‘OldServer, and ‘NewServer’ variables with code like the following, which you can run on a document created on the old server and another created on the new server, both referencing the same template.

      Code:
      Sub GetTemplateRef()
      With ActiveDocument
        MsgBox Dialogs(wdDialogToolsTemplates).Template
      End With
      End Sub

      A non-macro workaround that’s fine for a few files is to open them on a stand-alone PC and delete the template references. Opening them on a stand-alone PC obviates the start-up delay you’ll get on a networked PC.

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    Viewing 4 reply threads
    Reply To: doc looks for template at old location

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: