Removing Unused Styles

by Allen Wyatt
(last updated May 3, 2014)

When you work with a document for a long time, or when you inherit a document from someone else, it is very possible that it contains styles that are no longer in use. You may want to get rid of these styles, but this can be dangerous to the format of your document if you start deleting them without knowing that they really are not in use.

This is where a macro comes in handy. It can quickly search through a document to see if a particular style is used anywhere. If it isn't, then the style can be easily deleted. The following macro, DeleteUnusedStyles, does just that.

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

Note that the macro ignores a style if it is a built-in style. This is because deleting a built-in style doesn't really delete it, but only resets that style to its original, default condition. In fact, Word doesn't allow built-in styles to be deleted from a document. Even if the built-in style is no longer used, but was once used in the document, it will still show up in the styles drop-down list. If this bothers you, there are additional steps you can take to "delete" the listing of these built-in styles. These steps can be rather involved, and are best described in Knowledge Base article 193536:

http://support.microsoft.com/kb/193536

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1337) applies to Microsoft Word 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Printing Multiple Worksheet Ranges

Need to print more than one portion of your worksheet? If you use named ranges for the different ranges you want to print, ...

Discover More

Full-Screen Mode in Word 2007

Full-screen mode in Word 2007 doesn't work exactly the same as it did in earlier versions of Word. Don't fret; the ...

Discover More

Changing the Orientation of Your Chart

Microsoft Graph is a great way to add simple charts to your documents. Once you've got a graph added, you might want to ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

MORE WORDTIPS (MENU)

Finding Unused Styles

Use this VBA macro to determine which styles are being used in the current Word document.

Discover More

Preserving Style Formatting when Combining Documents

Insert one document into another and you may not get the results you expect. Here's why, along with what you can do about it.

Discover More

Changing Styles

Styles are a great boon to making your documents look better and making them easier to update. You can change the formatting ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)

This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.

Links and Sharing
Share