Removing Unused Styles from Word

Q. Is there a way to remove unused Styles from a Word document?

A. Yes there is, and it can be a real time-saver in certain situations.

Styles in Microsoft Word are similar to those in design applications in that they allow you to create and apply consistent formatting to text. This is especially useful when creating manuscript for lengthy content such as books and reference material, which can contain dozens, if not hundreds of categories and subcategories of styles. In fact, many editors and publishers require a highly “styled” Word document to define the typographic elements.

So when and why would you need to remove styles? A common occurrence is ‘inheriting’ a document cluttered with unused styles, which can slow down both your own and your software’s performance. Case in point: I’m working on the 4th edition of my book, Type Rules! The designer’s guide to professional typography. My publisher sent me the previous Word manuscript consisting of 14 separate documents. When I opened any document, or went from one to the next to shift content around, I’d get the dreaded ‘spinning beach ball’ that took no less than 45 seconds to stop each time – unbelievably exasperating!

Upon close investigation, I noticed that although I was only using 16 styles, there were over 300 of them listed in the Styles pane, resulting in a bloated document and very sluggish performance. Once I removed all unused styles, the spinning ball disappeared, and my work sped up immensely.

Figure 1: The pane on the left shows the 16 Styles In Use in my document, while the pane on the right is set to show All Styles in the entire document, which totals over 300!

So how did I do this? While unused Styles can be removed manually, it can get both tedious (as in my case), and dangerous to the formatting of your document if you remove the wrong ones. Although Word allows you to view ‘Styles in Use’ as opposed to those ‘In Current Document’, it does not provide an automatic way to remove them. Here is where a macro comes to the rescue!

A macro is a set of automated instructions to achieve a specific task – in this case, to search for and remove unused styles. This macro has to be manually set up, but don’t panic – I am not a programmer and I figured it out in 10 minutes on my Mac using Word for Mac 2011. Here’s what I did:

To create a macro

Go to Tools > Macro > Macros…

Macro name: DeleteUnusedStyles

Hit Create

Figure 2: Creating a macro is a fairly simple operation in the Macro pane.

In window that opens (mine says Normal.dotm – NewMacros (Code), replace existing copy with this code:

Sub DeleteUnusedStyles()
    Dim oStyle As Style
    For Each oStyle In ActiveDocument.Styles
        ‘Only check out non-built-in styles
        If oStyle.BuiltIn = False Then
            With ActiveDocument.Content.Find
                .ClearFormatting
                .Style = oStyle.NameLocal
                .Execute FindText:=””, Format:=True
                If .Found = False Then oStyle.Delete
            End With
        End If
    Next oStyle
End Sub

Close window, and click back on document.

Figure 3: Delete all code in the Normal.dotm pane and replace with the new code here.

To run the macro:

Go to Tools > Macro > Macros…

Select the DeleteUnusedStyles macro, and click on Run.

Figure 4: Running a macro is even easier!

Voilà! Now your Word doc is lean, mean, and fast.

NOTE: The procedure might vary slightly for different versions or platforms of Word or on a PC, but the concept should be the same. In addition, note that the macro will not remove built-in styles. An additional resource for more details is the Microsoft Word Forum.

Bookmark
Please login to bookmark Close

This article was last modified on July 29, 2021

Comments (30)

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. anonymous
    August 8, 2024

    I have a Syntax Error. Can someone help please?

  2. Christina
    February 26, 2024

    This is really useful, many thanks!
    However, for some reason styles used in footnotes, as well as character styles used in the document are removed – is there a way to keep these as well, in addition to the paragraph styles used in the main text?

  3. Christina
    December 17, 2023

    It works as a charm – but I would also like to delete all unused built-in styles in my document and tried removing the “If oStyle.BuiltIn = False Then” and “End If”
    but got a run-time error ‘4198’ “Command failed” and the debugger highlights “oStyle.Delete” as the problem.
    Do you know why this is?

  4. Catherine
    May 21, 2019

    When I changed the top line from: Sub DeleteUnusedStyles() to: Sub DeleteUnusedStyles it worked. Bl00dy brilliant. Thanks! :-)

  5. Ginny Barnett
    September 18, 2018

    Forgot the important part – I had so many styles to delete that I ran out of memory while running the macro.

  6. Ginny Barnett
    September 18, 2018

    To Jamie, Karen, etc.: Yes, the problem is that the commented line starts with a right single quote in the code we’re supposed to paste. Remove that and put in a straight apostrophe (single quote or ‘ or Unicode 0027), and the macro runs fine.

  7. Jim T
    April 30, 2018

    Many thanks. 79 thanks on just the first use.

  8. Bea
    November 27, 2017

    Thanks so much everyone for the comments and the work-through, replacing the ‘ with my own ‘ on that line did the trick for me as well.

  9. Jamie
    July 5, 2016

    Hi All,
    In reference to those using this on a Mac and coming across an error on the text reading ‘Only check out non-built-in styles, I was able to fix this simply by replacing the single quote/apostrophe, as it seemed to be a special character when I pasted it in my Visual Basic Editor. Worked perfectly after this fix!

    1. Karen
      December 30, 2016

      Thanks Jamie. Had the same problem on a PC and replacing the ‘ with an ‘ on that line did the trick.

  10. Tjerk
    March 4, 2016

    It works great! Word 2011 (14.6.1) on Mac with El Captain
    The macro first stopped at the line with comment
    ‘Only check out non-built-in styles
    but after removing that line it worked like a charme.
    Thank you, a real time saver!

  11. Guest
    October 22, 2014

      Save it as .RTF, then close it, then open the .RTF in  MS Word, and save it again in .DOC format. 

      Worked with me!

      Regards!

  12. pica_pau
    October 22, 2014

    Save it as .RTF, then close it, then open the .RTF in MS Word, and save it again in .DOC format. Worked with me! Regards!

  13. AaronPortland
    November 26, 2013

    Thanks for this. It would be nice if it also removed unused table styles, of which Word has many!

  14. Ravikumar M
    November 2, 2013

    Hi,

      Its really great idea to removing unused styles but i have a problem after removing unused styles some times i.e. after removed ununsed styles it will make corrupt other applied styles for some times. So, if u have any solution for that?

  15. Murray Leaf
    June 15, 2013

    This seems to be working. Even if it does not I had not known I could tell Word to show me only styles in use. This also helps. But I had to remove the remark in red in your sample for it to work.

  16. Anonymous
    February 4, 2013

    I not sure this worked for me – I had a compile error on the line ” ‘Only check out non-built-in styles” I changed it to a comment, assuming that is what it was suppose to be. (green vs red in color)

    I would like to know how to remove entries from the styles drop down on the formatting toolbar. There are tons of “accent” styles that just get in the way. I’m using Word for Mac 2011 Version 14.3.0 on a 17in Macbook Pro. I hunted for answers and found none.

    Ideas? Jim

    1. CHristina
      December 17, 2023

      I use Windows and had to replace the ‘ with a new “normally formatted” ‘

  17. Strizver
    October 30, 2012

    10/30/12

    The macro instructions have been revised and should now work.

    For Microsoft Office support, go to https://answers.microsoft.com/en-us/office/forum/word

    Thanks for your patience,
    Ilene

    .. .. .. .. .. .. .. .. .. .. .. .. .. ..

    T H E T Y P E S T U D I O
    Westport, CT
    203.227.5929
    http://www.thetypestudio.com/

  18. Anonymous
    October 20, 2012

    I previewed the 3rd edition on Amazon. I really want this book but if the next edition is coming out soon…
    Thank you,
    Susan Cervantes
    scervantes2011@yahoo.com

  19. Strizver
    October 18, 2012

    Stay tuned, I’m working on a revision! I was a little too hasty in posting this without enough testing (boy is my face red!) but will have it updated as soon as possible. Feel free to email me directly to be notified of the update.

    Thanks,
    Ilene@thetypestudio.com

    .. .. .. .. .. .. .. .. .. .. .. .. .. ..

    T H E T Y P E S T U D I O
    Westport, CT
    203.227.5929
    http://www.thetypestudio.com/

  20. Anonymous
    October 18, 2012

    I ran into a problem while pasting the description, it would only paste half of the copied text and I was not able to add the other half in a second attempt, the form did not accept ANY additional input.

    Am I doing something wrong?

  21. Anonymous
    October 18, 2012

    Yep, macro text seems to be too long to be accepted on Mac Word 2011 here too. What to do?

  22. Anonymous
    October 18, 2012

    1st, will the extra style be removed from the ribbon bar style drop down?

    2nd, I went to the Visual Basic Editor and was able to add the text above, but I had to remove the comment mark. When I pasted what I could in the description box, it showed as one long comment, thus I suspect that is where the limitation that I and other found.
    I looked at https://mac2.microsoft.com/help/office/14/en-us/excel/item/a94ea58a-3a46-4d14-bb32-7459783af9ef to see what the formatting needed to be.

  23. Anonymous
    October 18, 2012

    I tried pasting the macro into the description and the dialog only allowed about half of the text. I tried removing spaces and returns and it still will not fit. Is there a preference somewhere that I need to change? On a Mac using word for mac 2011.

  24. Anonymous
    October 18, 2012

    From one writer to another, if you build your manuscript in Scrivener you need not worry about styles or multiple documents at all, not until you’re ready to output your manuscript for submission. I switched about four years ago and use it for all of my fiction and nonfiction projects, blog entries, and storyboards. So far I haven’t figured out how to make it work for curriculum writing, or how to give me more hours in my day.

  25. Anonymous
    October 17, 2012

    Same comment as previous; I even tried typing in the code directly but the description box won’t accept that many lines of text. thanks.

  26. Anonymous
    October 17, 2012

    Mac, Word 2011, v14.2.4. When I paste the macro code into the Description area it is truncated after the “.ClearFormatting” line. Anyone else having this problem?

  27. Anonymous
    October 17, 2012

    Thank you in advance for all the exasperation you’ve just saved me! I can’t believe this isn’t a built-in feature in Word!!!

  28. Anonymous
    October 17, 2012

    I tried to make this macro, but every time I tried to paste the text it stopped after the word: ClearFormatting. No matter how I tried it wouldn’t go further, so I had to cancel.
    What’s the problem?