bottom
Great WordTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > WordTips Home > Formatting > Styles > Removing Unused Styles

Removing Unused Styles

Summary: Got an older document that has a bunch of unused styles defined in it? You can get rid of those styles easily by using the short macro in this tip. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)

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/?kbid=193536

Tip #1337 applies to Microsoft Word versions: 97 | 2000 | 2002 | 2003 | 2007


More Power! For some people, the prospect of creating Word macros can be scary. WordTips: The Macros can help you conquer your fears and you'll discover you're much more confident and productive as you make Word do exactly what you want. This is an invaluable source for learning macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of WordTips. Learn at your own pace, exactly the way you want.
 
Check out WordTips: The Macros today!

Helpful Links

Ask a Word Question
Make a Comment

Tips.Net Home
Tips.Net Store

WordTips FAQ
WordTips Premium

Learn Access Now

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

 

Great Info!

Get tips like this every week in WordTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)