Reading Time: minutes remaining

A simple macro to copy styles from one doc to another

Jason Morrell

by Jason Morrell 
December 11, 2021

Who needs this macro?

You may be wondering:

How do I copy styles from one document and another,

or a slight variation ...

How do I copy styles between Word documents without having to recreate them all again? 

One approach is to use the Styles Organiser.

First, copy the styles from the source document to the Normal template.

Then copy styles again from the Normal template to the destination document.

However, you can create the following macro and attach it to a Quick Access icon to make the process one-click-simple.

For example if you have a collection of training manuals that all use the same styles then this technique is a perfect fit.

Here's the process to set that up.

Step #1: Create the master document

1.  Create and save a master document that contains all your master styles. You may save the file as docx or dotx. It makes no difference to this process.

2.  Open File Explorer and get the full path and filename of your master document as follows:

a) How to obtain the full pathname in Windows 10

If you are using Windows 10, locate your document then click in the address bar to see the full path and filename. 

How to get the full path and filename in Windows 10

b) How to obtain the full pathname in Windows 11

If you are using Windows 11, locate your document then right-click it and choose Copy as path

Save as path

Step #2: Create the macro code

3.  In any document press Alt F11 to open the Visual Basic Editor.

Depending on your keyboard setup, you may need to press Fn Alt F11.

4.  On the left sidebar click Normal to select it, then select the Insert menu and choose Module,

Create a new macro module in the Normal template

5.  In the main code window paste the following code, replacing xxxxx with the full path and file name from step 2 above.

Sub Copy_styles_from_master_doc()
    ActiveDocument.CopyStylesFromTemplate _
    Template:="xxxxx"
End Sub

6.  Press F4 (if necessary) to display the Properties window on the left sidebar.

7.  Next to (Name), type Copy_styles_from_master_doc - you can use any name but spaces aren't allowed.

8.  Click X to close the code window. Changes are saved automatically.

Create VBA module

Step #3: Create an icon to run the macro

9.  Back in Word, click File | Options | Quick Access Toolbar.

10. Change Popular Commands to Macros.

11. Select the Normal.Copy_styles_from_master_doc macro.

12. Click Add >> between the 2 lists.

13. (Optional) Click Modify under the right-hand list.

14. (Optional) Choose any icon you like.

15. (Optional) Change the Display Name if you want.

16. Click OK to close the Symbol dialog. 

17. Click OK to close the Word Options dialog. 

Add the macro to the Quick Access Toolbar (QAT) and if you want, change the icon and display name

The new icon to run the macro is now situated in the QAT.

Now, in any document, when you click the macro icon, all the styles from the master doc are copied to the current doc. 

Now, with one click of the macro icon in the QAT, you can run the macro to update all the styles in the current document with those from the master document

Any styles that already exist in the current document will be updated.

Any styles that do not exist in the current document will be added.

There are no confirmations or warnings.

What Next?

I hope you found plenty of value in this post. I'd love to hear your biggest takeaway in the comments below together with any questions you may have.

Have a fantastic day.

Jason Morrell blog signature
About Jason Morrell

About the author

Jason Morrell


Jason Morrell is a professional trainer, consultant and course creator who lives on the glorious Gold Coast in Queensland, Australia.


He helps people of all levels unleash and leverage the power contained within Microsoft Office by delivering training, troubleshooting services and taking on client projects. He loves to simplify tricky concepts and provide helpful, proven, actionable advice that can be implemented for quick results.


Purely for amusement he sometimes talks about himself in the third person.

SHARE

more from

Office Mastery logo
Read More
Multilevel numbering in Word that works perfectly, first time
Read More
How to Create & Manipulate Tables in Word

JOIN THE DISCUSSION

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>