How to determining all information about used style?

A

avkokin

Hello. The pointer is on some word into one paragraph. I need get all
information about used the style of current word. How? Of course,
programmatically.
For example, I can get name of the style:
ActiveDocument.Paragraphs(1).Style
But how can I get and other info (name of font, size, etc)?
Thank you very much.
 
A

avkokin

Sorry, to get the name of current style can so: Selection.Style (not
ActiveDocument.Paragraphs(1).Style).
 
H

Helmut Weber

Hi Anton,

perhaps you mean somthing like that:

Sub Test5a()
Dim oSty As Style
Set oSty = Selection.Style
MsgBox oSty.Font.Bold
' ...
End Sub

though, I think, there is no way to loop
through all properties of an object.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
K

Klaus Linke

avkokin said:
Sorry, to get the name of current style can so: Selection.Style
(not ActiveDocument.Paragraphs(1).Style).

BTW... Selection.Paragraphs(1).Style -- in Word2003 and earlier -- would be
safer, to get at the paragraph style.
With Selection.Style, you don't really know which type of style Word will
return.

Word2007 has new properties
Selection.Range.ParagraphStyle
Selection.Range.CharacterStyle
Selection.Range.TableStyle
Selection.Range.ListStyle
that make it easier to get at the style type you're interested in.

Regards,
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