|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Assembly: Microsoft.Office.Interop.Excel (in microsoft.office.interop.excel.dll)
A shape range can contain as few as a single shape or as many as all the shapes on the document. You can include whichever shapes you want — chosen from among all the shapes on the document or all the shapes in the selection — to construct a shape range. For example, you could construct a ShapeRange collection that contains the first three shapes on a document, all the selected shapes on a document, or all the freeforms on a document.
This section describes how to:
Return a set of shapes you specify by name or index number.
Return all or some of the selected shapes on a document.
Returning a Set of Shapes You Specify by Name or Index Number
Use Shapes.Range(index), where index is the name or index number of the shape or an array that contains either names or index numbers of shapes, to return a ShapeRange collection that represents a set of shapes on a document. You can use the Array function to construct an array of names or index numbers.
Although you can use the Range property to return any number of shapes or slides, it's simpler to use the Item method if you want to return only a single member of the collection. For example, Shapes(1) is simpler than Shapes.Range(1).
Returning All or Some of the Selected Shapes on a Document
Use the ShapeRange property of the specified object to return the shapes associated with the object.