A Global StyleSheet in Microsoft Word
Global Templates work very well for sharing most kinds of customizations in Word. The big exception is styles. Styles contained in global templates are ignored by documents.
A macro, though, can be used to copy styles from a global template to the active document. A sample global stylesheet template with this macro can be downloaded from my download page.
What follows is a macro to copy the style Body Text and Heading Styles 1-9 from a global template to the active document. If there is no document open, it will generate a message box.
Before copying the styles, the macro asks whether the person is sure that he/she wants to redefine the styles. If "yes", then it will copy the styles using the Organizer. If no, it exits.
Sub StyleCopyMacro() ' ' StyleCopy Macro written by Charles Kyle Kenyon 14 November 2001 ' Copyright 2001 All rights reserved ' Copies styles from stylesheet global template to active document ' ' Declare variables Dim sThisTemplate As String Dim sTargetDoc As String Dim i As Integer ' Counter 1 - use for copying styles three times Dim iCount As Integer ' Counter 2 - use to loop copying of heading styles Dim rResponse As Variant ' can be vbMsgBoxResult in Word 2000 or later ' Error Handler set On Error GoTo NoDocument ' Call when no document is open. ' Define This Template and Target Document variables sThisTemplate = ThisDocument.FullName ' name and path of global template sTargetDoc = ActiveDocument.FullName 'generates error if no document open ' If any other errors, continue on On Error Resume Next rResponse = MsgBox(Prompt:="This command redefines your Body Text Style and" _ & vbCrLf & "Heading Styles 1-9. Are you sure you want to do this?" _ & vbCrLf & vbCrLf & "If you are not sure, answer 'No' and make a backup of your document." _ & vbCrLf & "Then run the command to copy the styles again.", _ Title:="Are you sure you want to redefine your styles?", _ Buttons:=vbYesNo + vbExclamation) If rResponse = vbNo Then Exit Sub ' Copy Body Text and Heading Styles to Active Document ' Note that this requires exact style names For i = 1 To 3 ' copy styles three times to maintain linkages With Application .OrganizerCopy Source:=sThisTemplate, _ Destination:=sTargetDoc, Name:="Body Text", Object:= _ wdOrganizerObjectStyles For iCount = 1 To 9 'Copy heading styles 1-9 .OrganizerCopy Source:=sThisTemplate, _ Destination:=sTargetDoc, Name:= _ "Heading " & iCount, _ Object:=wdOrganizerObjectStyles Next iCount End With Next i Exit Sub ' Skip error handler routine NoDocument: ' Error Handler - Will be called if there is not an open document MsgBox Prompt:="Sorry, this command is only available when you have a document open.", _ Title:="No document open!", Buttons:=vbExclamation End Sub
End of procedure (macro). (I didn't say it would be easy, just that it could be done!)
For instructions on copying this macro into your own template, see Macros and VBA or Installing Macros. Otherwise, the sample template already has it installed. It also uses the keyboard shortcut Ctrl+Alt+Shift+2 (Ctrl+Alt+@) to run the macro.
See Understanding Styles in Microsoft Word for more on styles. You may also want to take a look at the StyleRef Field Tutorial, the IncludeText Field Tutorial, and the Letterhead Textboxes and Styles Tutorial for a better idea of how styles can interact with each other.
Paul Edstein posted a macro on the Windows Secrets Lounge 2013 that copies all styles used in text in a document to all open documents. This could easily be adapted to use in a global stylesheet as well. Again, look into using Style Sets and Themes.
Many people visit this site and use the information it
Copyright 2000-2018 Charles Kyle Kenyon
FAQ provided as an adjunct / hobby as a part of my web site as a
criminal defense lawyer.