API Documentation > CorelDRAW > 2025-v26 > Layer > IVGLayer
Layer.FindShapes method
Returns a collection of shapes (ShapeRange) based on search criteria
Syntax:
Function FindShapes(Optional ByVal Name As String, Optional ByVal Type As cdrShapeType = cdrNoShape, Optional ByVal Recursive As Boolean = True) As ShapeRange
Parameters:
Name Type Description
Name
String
Type
Specifies the shape type, and returns cdrShapeType.
Recursive
Boolean
Specifies whether to iterate through all shapes.
Remarks:
The FindShapes method locates all shapes on a layer that have the specified properties. It returns a ShapeRange object containing all shapes found.
Examples:
The following VBA example finds all rectangles on the current layer and fills them with a red uniform fill.
Sub Test()
Dim sr As ShapeRange
Set sr = ActiveLayer.FindShapes(Type:=cdrRectangleShape)
If sr.Count <> 0 Then
  sr.ApplyUniformFill CreateRGBColor(255, 0, 0)
Else
  MsgBox "There are no rectangles on the current layer"
End If 
End Sub