Word multiple selections

1

11x22

Hello.

Does anyone know whether there is a way to deal with multiple Word
selections (with Ctrl key)? There is only one Selection object in
Application.ActiveDocument and there seem to be no way to obtain all text
ranges from all multiple selections only the last one. Is there any way to
deal with this limitation?
 
K

Klaus Linke

11x22 said:
Hello.

Does anyone know whether there is a way to deal with multiple Word
selections (with Ctrl key)? There is only one Selection object in
Application.ActiveDocument and there seem to be no way to obtain all text
ranges from all multiple selections only the last one. Is there any way to
deal with this limitation?


Unfortunately, VBA support for multiple selections was never implemented.

All that's available (as far as I'm aware) are two WordBasic commands,
WordBasic.ShrinkMultiSel to shrink the multiple selection to the last item,
and WordBasic.SelectSimilarFormatting to create a multiple selection of all
text that matches that of the current selection or insertion point.

If you want to deal with multiple text selections in VBA, you could apply a
specific character formatting that is very unlikely to appear in any
document (say the text animations like marching red ants, or "Shadowed", or
"Outlined"), then use Range.Find to go through those ranges with your macro,
and later remove that font formatting again.

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