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.
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?
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!!!
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?
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.
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.
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.
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.
Yep, macro text seems to be too long to be accepted on Mac Word 2011 here too. What to do?
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?
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,
[email protected]
.. .. .. .. .. .. .. .. .. .. .. .. .. ..
T H E T Y P E S T U D I O
Westport, CT
203.227.5929
http://www.thetypestudio.com/
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
[email protected]
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/
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
I use Windows and had to replace the ‘ with a new “normally formatted” ‘
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.
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?
Thanks for this. It would be nice if it also removed unused table styles, of which Word has many!
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!
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!
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!
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!
Thanks Jamie. Had the same problem on a PC and replacing the ‘ with an ‘ on that line did the trick.
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.
Many thanks. 79 thanks on just the first use.
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.
Forgot the important part – I had so many styles to delete that I ran out of memory while running the macro.
When I changed the top line from: Sub DeleteUnusedStyles() to: Sub DeleteUnusedStyles it worked. Bl00dy brilliant. Thanks! :-)
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?
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?