How do I select a Shape

C

Colbert Zhou [MSFT]

Hello Dave,

Shape do not have a range property, but a Anchor property which is range
type. Indeed, the InlineShape has a Range property which represents its
location.

All shapes are stored in the collection of Document.Shapes property and all
Inline Shapes are stored in Document.InlineShapes collection. I think we'd
need to iterate the Document.InlineShapes and match the shape using the
shape.Range.Start and End. If it matches, then we can call Select on that
shape.


Codes like:
foreach(Word.InlineShape shape in Application.ActiveDocument.InlineShapes)
{
if(shape.Range.Start == 43 && shape.Range.End == 44)
{
shape.Select();
}
}

Hope this helps and wish you have a good day!

Best regards,
Ji Zhou
Microsoft Online Community Support
 
D

David Thielen

That will work - thanks - dave


Hello Dave,

Shape do not have a range property, but a Anchor property which is range
type. Indeed, the InlineShape has a Range property which represents its
location.

All shapes are stored in the collection of Document.Shapes property and all
Inline Shapes are stored in Document.InlineShapes collection. I think we'd
need to iterate the Document.InlineShapes and match the shape using the
shape.Range.Start and End. If it matches, then we can call Select on that
shape.


Codes like:
foreach(Word.InlineShape shape in Application.ActiveDocument.InlineShapes)
{
if(shape.Range.Start == 43 && shape.Range.End == 44)
{
shape.Select();
}
}

Hope this helps and wish you have a good day!

Best regards,
Ji Zhou
Microsoft Online Community Support


david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 

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