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

Change Template name and location on-mass

I have a user with hundreds of words docs that used a template on a server that has now been decommissioned.
all the word docs still try and pull the template links from the decomission server and therefore they take ages to open.
i have found if i click on Tools and Templates and Add-Ins and change the template link to Normal.dot on the local machine it removes the problem.
However, as there are so many of these files, opening each one and doing this is not an option.
anyone know of a way i could do this on mass or use a tool to do it?

thanks
0
naifyboy123
Asked:
naifyboy123
  • 8
  • 7
  • 5
  • +1
1 Solution
 
Netman66Commented:
Download and install the Office Group Policy Templates.
Create and link a GPO (after you copy the ADMs and add them to the policy) to an OU that covers all the workstations.
Set this option:

User Configuration>Admin Templates>Microsoft Office 2003>Shared Paths>User Templates Path

or you may need to go into the Microsoft Word 2003 element under; File Locations.

Point it to where Normal.dot is located.

 
0
 
naifyboy123Author Commented:
Great - looks good, but:

i do not need to change anything apart from the template to point to normal.dot on the local machine and how would i run this? I.E what do i save the script as and how do i run it?

thanks
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
Netman66Commented:
0
 
naifyboy123Author Commented:
Netman66:
they use office 2002 - but i assume the adm will have a similar setting.

if i apply this as a GPO setting and then remove the GPO once the clients are configured, what then happens? will they then revert back to the original location?

it's just that i dont want this GPO setting to be there forever...
thanks
0
 
Netman66Commented:
If you look at a machine that still points to the old server, where is this information located that you change?

Is it in file locations>User templates?  If so, the GPO method will fix this pretty easily.

Work will always search the default locations should the non-default be unavailable.

Where are you pointing it to manually - the exact path?

0
 
KCTSCommented:
The script is a word macro
Just go into Tools, Macro, Macros
In the Macro Name box type: BatchTemplateChange
and press Enter

copy and paste the following before the End Sub

With Application.FileSearch
   .FileType = msoFileTypeWordDocuments
   .LookIn = "C:\Mijn Documenten\" 'Specify the folder to look from
   .SearchSubFolders = True 'It will include subdirectories !
   .Execute
   For i = 1 To .FoundFiles.Count
       Documents.Open .FoundFiles(i)
       With ActiveDocument
           .UpdateStylesOnOpen = False
           'Change the template path below to the path to a known existing template
           .AttachedTemplate = "C:\Program Files\Microsoft Office\Templates\Normal2.dot"
       End With
       ActiveDocument.Save
       ActiveDocument.Close
   Next i
End With

Ammend the .lookin folder and .Attatched template as required
Click on the X itop right to close the Visual Basic Window

To run the macro select Tools, Macro, Macros
Highlight the macro and select RUN
0
 
Netman66Commented:
Office XP uses different templates: http://office.microsoft.com/en-us/orkXP/HA011362921033.aspx

As long as the User Templates is located in the Default place in the user's profile - or - in the Office directory, then leaving the GPO in place won't hurt anything since you should be adding new templates there.

If, you decide to change this to a network server later, then simply adjust the GPO to point there - it's really that easy using the templates.

0
 
naifyboy123Author Commented:
Netman66: - the location of the template linked is not held on the client - it is linked to the files themselves.
i have copied some of the files involved to new machines and they still try and open the linked template.
0
 
Netman66Commented:
The files have a path - don't they?

When you link them, you must drill down to where they are located - correct?

Other than that, copy the Normal.dot into the default location using a logon script then delete all other normal.dot files in the user's profile and on the hard drive.

Use the User Template path to point to the default location.

It should "unhook" itself from the current template if it isn't there.

0
 
Netman66Commented:
Oh, I think I understand you now.  The original documents used a template that isn't available now and every time you open them you get a huge delay - is that correct?

0
 
KCTSCommented:
Running the word Macro will open all the word documents in the specified folder, change their attatched template and save it again. It just automates the process that you were doing manually.
0
 
Netman66Commented:
I see your logic KCTS, however doing this on every file would be a lot of work.

In order to kill this you need to delete the registry key for the template which forces the document to open using the global Normal.dot.

This tool will help you isolate what entry you need to deal with, then you can create a registry file to run at logon and clean up the key.

http://www.microsoft.com/downloads/details.aspx?FamilyID=efb7219f-aaf5-4858-8abe-0b08aeb69664&displaylang=en
0
 
naifyboy123Author Commented:
Netman66 - yes that is the problem - are you now saying the GPO option will not help me?

KCTS - as mentioned earlier - i only need to change the path of the template and nothing else. can you adivse how to write the macro with that in mind?

thanks guys
0
 
KCTSCommented:
The macro automatically changes the template on existing documents which is what naifyboy123 actually asked for!

The only work involved is pasting the macro into word and selecting RUN.
0
 
KCTSCommented:
To modify the macro all you have to do is change two things

 .LookIn = "C:\Mijn Documents\" 'Specify the folder to look from

needs to point to the folder that contains the files to be changed and the line that currently says
  .AttachedTemplate = "C:\Program Files\Microsoft Office\Templates\Normal2.dot"

Needs to be changed to the full pathname of the template, so if the new template is called xyz.dot and is in the templates folder on drive H: it needs to read

 .AttachedTemplate = "H:\Templates\xyz.dot"
0
 
naifyboy123Author Commented:
the macro solution is not viable!

the fact it has to open the document is no different to a user opening it and it takes ages.
it also left a temp file behind and corrupted the data

again, there are hundreds of these files so this solution will not work.
any other solutions anyone?
0
 
GrahamSkanCommented:
Hi. You will have temporarily to re-instate the old server and templates path while you run the job.

This question had a successful outcome. It has a recursive search, so that the target documents can be anywhere in a directory structure, rather than in a single folder.

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Word/Q_22642821.html
0
 
naifyboy123Author Commented:
thank you graham.

i assume the code mentioned could alos be run as a macro within word could it?

thanks
0
 
GrahamSkanCommented:
Ye, in fact it was developed as a Word macro.

Looking at it closely this morning, I see that I haven't shown a calling sub, like:

SuB ChangeTemplates
  FindFiles "C:\DocumentFolders", "*.doc"
End sub

0
 
naifyboy123Author Commented:
Sorry you lost me there - could i ask that you post all the code i would need to use.....thanks again
0
 
GrahamSkanCommented:
Sorry to confuse you:

Option Explicit

Sub ChangeTemplates()
  FindFiles "C:\DocumentFolders", "*.doc"
End Sub

Sub FindFiles(strFolder As String, strFilePattern As String)
    Dim strFileName As String
    Dim strFolders() As String
    Dim iFolderCount As Integer
    Dim i As Integer
   
    '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
            Documents.Open strFolder & "\" & strFileName
            If ActiveDocument.AttachedTemplate.Path = "\\Oldserver\templates\" Then
                ActiveDocument.AttachedTemplate = "\\NewServer\templates\" & ActiveDocument.AttachedTemplate.Name
                ActiveDocument.Close wdSaveChanges
            Else
                ActiveDocument.Close wdDoNotSaveChanges
            End If
        strFileName = Dir$()
    Loop
   
    'look through child folders
    For i = 0 To iFolderCount - 1
        FindFiles strFolders(i), strFilePattern
    Next i
End Sub

0
 
naifyboy123Author Commented:
thank you - i have tested it and early impressions are that it works well.

i created a client with the same name as the decomissioned server.

thanks again.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 8
  • 7
  • 5
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now