Hi Andreas,
Which version do you use? Word 2007 has a new property for styles, .Linked,
which can make it easier.
In previous versions, I tested each character(!) style on whether it was
linked to a paragraph style.
Then if that wasn't the "Normal" (Standard) style, I checked the linked
paragraph style whether it was linked to the character style.
Any regular character style will report "Normal" as its linked style (...
pretty weird, but it's not my design).
It seems to me, if those two conditions are met, it's a Char style.
The name doesn't matter much... In German, it's "Zchn" rather than "Char",
in other countries other names.
"Char Char" styles are actually paragraph styles created by one of the
several bugs involved.
Also, any built-in or user-defined style (without "Char" in its name) can
become a linked style of some paragraph style (sometimes it seems
spontaneously by bugs).
So after that test, I'd link the Char style to the Normal paragraph style.
That turns it into a "plain" character style that you can see in the
interface (which you usually can't before, in Word 2003).
If you simply delete it (or link it to some new paragraph style and delete
that paragraph style, as your macro does), you'll loose all the formatting
that was done by the character style, and it'll revert to the default
paragraph font.
Maybe that's no problem for you, but in the documents I get, it often does.
So once the character styles are visible in the styles pane, I'll have to go
through them and decide whether to turn them into something else, or remove
them (and their formatting).
Regards,
Klaus
"andreas"
> Dear Experts:
>
> Below code which I found on the Internet creates a new style
> ("Style1"), links the "Char" style that bases on "Heading 2" to this
> new style, then deletes the new style.1.
> This way one can easily get rid of these awful linked character
> styles. These rogue characther styles (e.g. Heading 1 Char Char) are
> automatically created if one tries to apply a paragraph style to just
> part of a paragraph.
>
> The trouble is, I got a document which has literally hundreds of these
> (rogue) linked Character Styles. Is there a way to alter below code to
> include all linked "Char" Styles regardless of their exact name (e.g.
> Heading 1 Char Char Char or Table Body Text Char Char Char Char or
> just Char Char).
>
> Help is much appreciated.
> Thank you very much in advance.
>
> Regards, Andreas
>
> Sub DeleteHeading2Char()
> Dim styl As Word.Style, doc As Word.Document
> Set doc = ActiveDocument
>
> Set styl = doc.Styles.Add(Name:="Style1")
> On Error Resume Next
> doc.Styles("Heading 2 Char").LinkStyle = styl
> styl.Delete End Sub