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
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:
Dim oStyle As Style
For Each oStyle In ActiveDocument.Styles
‘Only check out non-built-in styles
If oStyle.BuiltIn = False Then
.Style = oStyle.NameLocal
.Execute FindText:=””, Format:=True
If .Found = False Then oStyle.Delete
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.