Global StyleSheet in Word - transferring styles from an Add-

User avatar
Charles Kenyon
5StarLounger
Posts: 609
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Global StyleSheet in Word - transferring styles from an Add-

Post by Charles Kenyon »

About 20 years ago, I wrote an article on transferring styles from an Add-In using the OrganizerCopy method.
Recently in a thread with Jay Freedman on the Answers forum I was reminded of the CopyStylesFromTemplate method which is substantially faster.

A difference is that the OrganizerCopy method copies styles one at a time while the CopyStylesFromTemplate method copies everything as if you had attached a template and checked the box to update styles. Another difference is that the second method only works from a template.

The discussion with Jay can be found in this thread:
https://answers.microsoft.com/en-us/mso ... e478ec069d

The following vba statement will copy all styles from the template containing the code (regardless of where it is located) into the active document.

Code: Select all

ActiveDocument.CopyStylesFromTemplate (ThisDocument.FullName)
I've updated my page with this in a macro that double-checks whether the user really wants to do it.
http://www.addbalance.com/word/stylesheet.htm That has a link to a download of samples.

User avatar
HansV
Administrator
Posts: 78402
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Global StyleSheet in Word - transferring styles from an

Post by HansV »

Thanks! :smile:
Best wishes,
Hans

User avatar
macropod
4StarLounger
Posts: 508
Joined: 17 Dec 2010, 03:14

Re: Global StyleSheet in Word - transferring styles from an

Post by macropod »

You may also be interested in: https://www.msofficeforums.com/28497-post34.html" onclick="window.open(this.href);return false;
Paul Edstein
[Fmr MS MVP - Word]

User avatar
Charles Kenyon
5StarLounger
Posts: 609
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Global StyleSheet in Word - transferring styles from an

Post by Charles Kenyon »

I've added links to your post in both my Global StyleSheet and Styles pages.
http://www.addbalance.com/word/styleshe ... tyleCopier