Forum Discussion
andgoo_
Jun 18, 2024Copper Contributor
Update Word template programmatically
It is possible to manually apply a new Word template via the following steps: Open the Word document you would like to apply the template to, then click File > Options to open the Word Options...
andgoo_
Jun 24, 2024Copper Contributor
Thanks for replying Charles.
I'm already aware of the relationship between a Word document and its template.
Obviously what I'm doing by attaching a different template us to apply a new template to a document which is using an old template with out-of-date formatting.
What I'm trying to accomplish is performing this task via code/script instead of manual steps.
I'm already aware of the relationship between a Word document and its template.
Obviously what I'm doing by attaching a different template us to apply a new template to a document which is using an old template with out-of-date formatting.
What I'm trying to accomplish is performing this task via code/script instead of manual steps.
Charles_Kenyon
Jun 24, 2024Bronze Contributor
The only formatting that can change by applying a new template to an existing document is Styles. Page layout and other formatting is not changed.
- You can, instead, apply a [Quick] Style Set. [Quick] Style Sets and Word Themes in Microsoft Word
- You can, instead, use the Organizer to copy styles. This can be done programmatically. See my webpage: A Global StyleSheet in Microsoft Word? and the demonstration sample Outline Heading Styles Global Stylesheet Add-In.
- Or, you can programmatically attach the template updating styles. I think the first two options are superior unless that template has something else you want like building blocks, keyboard shortcuts, or macros. In that case, though, why not simply load the template as an Add-In? That gives access to all of those without a change to the document's attached template.
If you really want option 3, I can write a macro for you. It may take me a couple of days because I have a day job.