Remove unused styles

K

Klaus Löffelmann

Hi,

I got a document from one of our writers, which unfortunately consists of
too many unused styles out of which only a few are really used.

Simple question: Is there a way, to remove all unused styles from such a
document, since the exsistence of all of them is simply too annoying now I
have to type-set the whole thing. And: I don't like to write a macro for
that (although, if somebody knew a source for such a macro, that would be
cool, too ;-)

Thanks,

Klaus
 
A

Andy

I got this from an issue of Editorium Update.

Use at your own risk.


===================================================



Sub DeleteUnusedStyles()
'Courtesy of the Editorium
'www.editorium.com
Dim sty As Style
For Each sty In ActiveDocument.Styles
If sty.BuiltIn = False Then
If sty.InUse = False Then
sty.Delete
Else
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
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
Selection.Find.Execute
If Selection.Find.Found = False Then sty.Delete
End If
End If
Next sty
Selection.HomeKey Unit:=wdStory
End Sub
 
S

Suzanne S. Barnhill

"Styles in use" will display the same list that is shown in the Style
dropdown--that is, all the styles that have ever been used in the document.
Displaying the Style Area and scanning it for styles suspected of not being
in use is tedious but may be the most efficient procedure. Styles (aside
from Normal, Default Paragraph Font, and the built-in heading styles) can
also be deleted from the "Styles in use" list in the Styles dialog.
 
S

Suzanne S. Barnhill

Yeah, one of those task pane subtleties that I have totally not mastered!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top