Deleting Unused Styles

I frequently edit books that are compilations of articles by various authors. Some know how to use Word pretty well; others don’t have a clue. Those in the latter category either don’t use paragraph styles or create styles that aren’t needed. After I’ve fixed and consistently applied the styles I need, I like to get rid of the other unused styles the authors have created. The following macro seems to do the job quite well. Maybe you’ll find it useful:

Sub DeleteUnusedStyles()
'Courtesy of the Editorium
For Each sty In ActiveDocument.Styles
If sty.BuiltIn = False Then
If sty.InUse = False Then
Selection.HomeKey Unit:=wdStory
Selection.Find.Style = ActiveDocument.Styles(sty)
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
If Selection.Find.Found = False Then sty.Delete
End If
End If
Next sty
Selection.HomeKey Unit:=wdStory
End Sub

If you don’t know how to use such macros, you can learn how here:

You’d think the macro could be a lot shorter:

For Each sty In ActiveDocument.Styles
If sty.BuiltIn = False Then 'Ignore built-in styles
If sty.InUse = False Then sty.Delete
End If
Next sty

But Microsoft Word, ever uncooperative, considers any style that has *ever* been used in a document to be “in use,” even if the text formatted by that style has long since been deleted. That means a style can be “in use” even if it’s not applied to text anywhere in the document. So, to see if a style is *really* in use, we have to search for text using that style. If no such text is found, then we know that the style really isn’t in use and can be deleted.

Note that the macro completely ignores Word’s built-in styles, since these *can’t* be deleted.



After reading last week’s article on pasting tracked revisions, Hilary Powers responded to the last paragraph in the article, which read, “But maybe, just maybe, it’s a feature, giving you a choice about whether or not to copy and paste revisions. But if that’s true, why not copy revisions when tracking is on, and *not* copy revisions when tracking is off? That would be more logical. Shoot, maybe it is a bug. If so, now you know how to squash it.”

Hilary wrote:

It’s a feature. Lots of times I’m working along, and I want to pull something from the main document, which has tracking active, to the style sheet–and I want the final version of whatever-it-is, not any changes I may have made in it. That wouldn’t be feasible with the apparently logical system. Keeping only the final version is the more likely choice, so it makes sense to have to do something to keep the tracking.

But it’s a feature only in Word 2000+; in Word 97, there’s a genuine bug: you can’t copy tracking AT ALL. If you want to reproduce a passage with tracking intact, you have to bookmark it, then use Insert, File, Range (bookmark name) to put the bookmarked passage into a file that has tracking turned off. (If you want the whole file, you can simply Insert it without the Range bit.)


Several readers responded to my answer to Wallace Sagendorph’s superscript problem in last week’s newsletter, including Mary Eberle, Eric Fletcher, Shirley S. Ricks, and Iwan Thomas. Eric Fletcher wrote:

I bet I won’t be the only one to let you know about a much easier method to solve Wallace Sagendorph’s superscript problem!

I would just change one instance manually, then select and copy it. Then, in the F&R dialog, put “m3” in the Find what and “^c” in the Replace with. The caret c replaces each instance found with the content of the clipboard.

Of course, your two-step method works for the general case but I’d be a little hesitant to use it unless I was pretty sure the manuscript didn’t include other constructions that would get messed up. For example, H2O would end up with a superscript 2 with your wildcard method. I once discovered (luckily just before press!) that the 2 in all instances of “V2 rocket” had inadvertently been changed to a superscript because of an earlier fix to km2.

I really like the “Highlight all items” feature of Word’s Find dialog as a tool to easily check the total number of items about to be changed. If it looks a bit too high or I’m not sure, I tick it to cause all found items to be highlighted, drop out of the dialog, copy and then paste into a new Word document. This gives me a list of all found items that is easy to sort or review before committing to the replace. We’ve done several jobs where URLs and email addresses are sprinkled throughout the ms. I tag them with “URL text” character styles (displayed in purple during editing). Not only is it easier to see this way, but the “highlight all/copy/paste to new doc” procedure gives me a sortable list of all such items–always very handy for confirming currency of such items. I also use a similar method for pulling all citations for easier checking.

Many thanks to Hilary, Mary, Eric, Shirley, and Iwan for their excellent tips and comments.



If you need help with Microsoft Word, there are actually lots of places to go. Some of the best include:

The Word-PC List:

The McEdit list:

Microsoft’s Word discussion groups:

(Look in the lower right of the page.)

The Word MVP site:

Woody’s Lounge:

But if you can’t find what you need in those places, send your question here:

mailto:help [at symbol]

I’ll put your question in the newsletter to see if some astute reader knows the answer.

This entry was posted in Editing. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

You must be logged in to post a comment.

  • The Fine Print

    Thanks for reading Editorium Update (ISSN 1534-1283), published by:


    Articles © on date of publication by the Editorium. All rights reserved. Editorium Update and Editorium are trademarks of the Editorium.

    You may forward copies of Editorium Update to others (but not charge for it) and print or store it for your personal use. Any other broadcast, publication, retransmission, copying, or storage, without written permission from the Editorium, is strictly prohibited. If you’re interested in reprinting one of our articles, please send an email message to

    Editorium Update is provided for informational purposes only and without a warranty of any kind, either express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, and freedom from infringement. The user (you) assumes the entire risk as to the accuracy and use of this document.

    The Editorium is not affiliated with Microsoft Corporation or any other entity.

    We do not sell, rent, or give our subscriber list to anyone.