Link to home
Start Free TrialLog in
Avatar of naifyboy123
naifyboy123Flag for Afghanistan

asked on

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
Avatar of Brian Pierce
Brian Pierce
Flag of United Kingdom of Great Britain and Northern Ireland image

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.

 
Avatar of naifyboy123

ASKER

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

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

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

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?

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.
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
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
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.
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"
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?
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.

https://www.experts-exchange.com/questions/22642821/Word-docs-reference-old-template.html
thank you graham.

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

thanks
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

Sorry you lost me there - could i ask that you post all the code i would need to use.....thanks again
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.