Word VBA - Formatting in Use

M

mohit_ranka

Dear All,
I want to get all the formatting styles used in the
active word document.Can anyone suggest me a method/property to use? I
do not want to manually iterate over thr whole word document and list
the styles paragraph-by-paragraph and character-by-characters.

Thanks and regards,
Mohit Ranka.
 
H

Helmut Weber

Hi Mohit,

perhaps like that:

Sub Test456v()
Dim oSty As Style
Dim oRng As Range
Set oRng = ActiveDocument.Range
For Each oSty In ActiveDocument.Styles
With oRng.Find
.Style = oSty.NameLocal
If .Execute Then
MsgBox .Style ' or debug.print .style
End If
End With
Next
End Sub


--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
J

Jessica Weissman

When I've tried a similar thing, it gets only the styles in the body of the
document. I need to get the styles in headers and footers as well.

Is there an easy way, or do I have to look at all the story objects in the
doc?

- Jessica
 

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