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 KB193536:
http://support.microsoft.com/default.aspx?scid=kb;en-us;193536
No comments:
Post a Comment