get only the formats available for the active word document

E

edo

Hi all,

I use word2002.
anybody knows if it is possible with a macro to simulate the following
function:

Format > Format Template (or something like that, I have a german
version)> mouse right click on a format > highlight all the instances
of this format in the document

Thanks!
 
H

Helmut Weber

Hi Edo,

so you want to add a macro to the menu displayed
when right clicking in "styles and formatting".

Must be pretty complicated and I wonder,
whether it is worth the effort.

I'd set up a userform,
read all styles in the doc,
which may take some time for a large document,
as "show: styles in use" does not return
the expected result.

I really don't know what is about.
There is no PrgGreen-Style in use in my test-doc.
Though, PrgGreen is in the list of styles in use.

Maybe I am totally off the track.

Put the names of styles in the doc
in a listbox, and highlight all paragraphs
in that style, when doubleclicking.
Not to forget removing highlighting before.

Assumed that this is about paragraph styles only.

Or, in a very simplified approach,
highlight all paragraphs of the style
of the first paragraph in the selection, like:

Sub Macro1()
Dim sStl As String
Dim oPrg As Paragraph
sStl = selection.Paragraphs(1).Style
ActiveDocument.Range.HighlightColorIndex = wdNoHighlight
For Each oPrg In ActiveDocument.Range.Paragraphs
If oPrg.Style = sStl Then
oPrg.Range.HighlightColorIndex = wdYellow
End If
Next
End Sub


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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