Finding Unnamed Styles

G

George Lee

I’m analyzing styles within a document. I can find most of them but there is
a class of styles that show up in the styles dialog box (Format->Styles and
Formatting…) that are not in the DOM Styles collection. There seem to be the
unnamed, not explicitly defined ones that are manual modifications of
existing styles. How can I find these programmatically?
 
C

Cindy M.

Hi George,
I’m analyzing styles within a document. I can find most of them but there is
a class of styles that show up in the styles dialog box (Format->Styles and
Formatting…) that are not in the DOM Styles collection. There seem to be the
unnamed, not explicitly defined ones that are manual modifications of
existing styles. How can I find these programmatically?
Could you please be more specific? Starting with the version of Word, and
including examples of such styles?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
S

Stefan Blom

This sounds like styles + formatting (which are displayed if you enable the
"Keep track of formatting" option) rather than styles, I believe.
 
K

Klaus Linke

Stefan Blom said:
This sounds like styles + formatting (which are displayed if you enable
the "Keep track of formatting" option) rather than styles, I believe.

If that option is set, you can get what's displayed from the styles
dropdown:

Dim myCBC As CommandBarComboBox
Dim i As Long

' 1732 is the ID of the "Style" graphic combo control
Set myCBC = CommandBars.FindControl(ID:=1732)

With myCBC
Debug.Print .Type
For i = 1 To .ListCount
Debug.Print i, .List(i)
Next i
End With

It may not help much though, since it's hard to tell what is a style and
what is formatting...
And for the formatting, how that text (say, "Blue, underlined") translates
into something you can actually work with in a macro (... say, search for).

Regards,
Klaus
 
K

Klaus Linke

It may not help much though, since it's hard to tell what is a style and
what is formatting...

That part of the problem could be solved by once getting the list with
"Options.FormatScanning = False" (styles only), and then again with
"Options.FormatScanning = True" (including manual formatting).

Klaus
 

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