Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacing templates in files already saved

Status
Not open for further replies.

kawnz

Technical User
Jan 30, 2003
67
0
0
US
I have a number of files that were based off a template called "Job Descriptions". Now my higherups want to use a template called "Procedures".
How can I replace the template for the files I have already created from Job Descriptions to Procedures and have them all work the way they would if I created them from scratch?
 
Hi kawnz,

I'm assuming that either the name of the template is important or these templates are used elsewhere and can't be renamed.

Somebody will prove me wrong but I don't think you can do this easily without code. The code you need is relatively simple ..

Code:
[blue]If ActiveDocument.AttachedTemplate = "Job Descriptions.dot" Then
    ActiveDocument.AttachedTemplate = "Drive:\Full Path\Procedures.dot"[/blue]

You could put it in an AutoOpen macro which would run when the documents were opened, or you could wrap it in some logic to do as a one-off exercise. Are all your files in a single directory or are they scattered. If you post back with a bit more info someone will guide you.

I can't guarantee they will work exactly as if you had created the documents with a different template to start with - that will depend to some extent on the code in the templates.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
Open the docs, go to the Tools menu, select templates and Add ins, click the Attach button and select the new template. This gives you all the styles, macros etc for the new template in the original doc.
HTH
 
thanks, will try the two options and see which works best for my situation.
the deal was that I was creating procedures using the job descriptions file, because that is what was sent to me to begin with. The format for the JD file is different from the procedures document, and they now want me to follow the format in the procedures file. The templates are in the templates directory and my procedures are in the procedures directory.
 
My two cents worth....

1. DO A TEST FIRST! Follow Moira's suggestion on a single document. Check it carefully. I can pretty much promise that it will not come out perfectly. This is for two reasons. First is it is very rare that users properly and ONLY use the styles and structure in a template. The second is that the new template styles and structure may conflict with the current document. The most common issue when doing this sort of stuff is a user entered page break. A properly used file, based from a template, should NEVER have a user entered page break. But people almost always do.

2. If the new template atatches OK, and it is acceptable, then use Tony's suggestion to batch the attaching. You can easily run through a whole folder of files by code.

Gerry
 
too right about styles and structure. I don't use them as much as I should, but we have people here that still put spaces instead of a tab, and use an * to signify a bullet and then hit enter and spaces until the beginning of the next line lines up with the first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top