How do I select all text with a specifc style?

D

Daren

When viewing the document styles using the task pane, it is possible to
select all instances of text using a specific style - how do I replicate that
in code? I tried recording a macro whilst using the task pane to no avail.

Thanks.
 
K

Klaus Linke

Nevermind - I forgot you could specify a style for the find method.


Hi Daren,

The command would be WordBasic.SelectSimilarFormatting

That works with manual formatting (the "pseudo-styles" that you see in the
"Styles and formatting" pane with "Keep track of formatting" on), too.

Greetings,
Klaus
 
D

Daren

Thanks for the reply.

Klaus Linke said:
Hi Daren,

The command would be WordBasic.SelectSimilarFormatting

That works with manual formatting (the "pseudo-styles" that you see in the
"Styles and formatting" pane with "Keep track of formatting" on), too.

Greetings,
Klaus
 
K

Klaus Linke

You're welcome! I never tried which is faster... but use "Find", too, since
it gives you more control.

Greetings,
Klaus
 
K

Klaus Linke

I never tried which is faster...

Argh... "Find" is faster.
"Select similar formatting" often takes minutes on documents of some size.

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