How to find all the selections

I

Inbar

If I'm using ActiveWindow.Selection to get a selection, I only get the last
selection that was made by the user. If the user selected 2 or more parts of
the document - how do I get the rest of them?

Thanks!


Inbar.
 
J

Jonathan West

Inbar said:
If I'm using ActiveWindow.Selection to get a selection, I only get the
last
selection that was made by the user. If the user selected 2 or more parts
of
the document - how do I get the rest of them?

As far as I know, you can't. VBA doesn't provide access to the multiple
selections.
 
K

Klaus Linke

You might apply some formatting that's unlikely to be used (finally a use for "marching ants" text effects?), and then use "Find" to loop all ranges that have that formatting applied, removing it in the process.

Klaus
 
I

Inbar

Klaus,
OK, let's assume I do that. I run "Find" and then what? How to I get all the
"range" objects for everything that was found? I don't really see how this
helps me. I will still have a multiple selection that I cannot use...

Klaus Linke said:
You might apply some formatting that's unlikely to be used (finally a use for "marching ants" text effects?), and then use "Find" to loop all ranges that have that formatting applied, removing it in the process.

Klaus
 
J

Jonathan West

Inbar said:
Klaus,
OK, let's assume I do that. I run "Find" and then what? How to I get all
the
"range" objects for everything that was found? I don't really see how this
helps me. I will still have a multiple selection that I cannot use...

if you apply the Marching Red Ants character format to the Selection, it
does in fact apply it to all areas of a multiple selection.

You can then do a Find, searching for examples of Marching Red Ants, adding
each area found to an array or collection of Range objects, removing the Red
Ants format in the process

You can then maniplate those ranges in any way you want.
 

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