API Documentation > CorelDRAW > 2025-v26 > ShapeRange > IVGShapeRange
ShapeRange.IndexOf method
Gets the index of a shape
Syntax:
Function IndexOf(ByVal Shape As Shape) As Long
Parameters:
Name Type Description
Shape
Remarks:
The IndexOf method returns the index number of a specified shape in a shape range. If the shape is not in the range, 0 is returned.
Examples:
The following VBA example determines whether the selected shape is a curve residing on the active layer of the document.
Sub Test()
Dim sr As ShapeRange
Set sr = ActiveLayer.FindShapes(, cdrCurveShape)
If sr.IndexOf(ActiveShape) = 0 Then
  MsgBox "The selected shape is not a curve residing on the current layer"
End If 
End Sub