API Documentation > CorelDRAW > 2025-v26 > Shapes > IVGShapes
Shapes.AllExcluding method
Gets the shape range excluding the indexes
Syntax:
Function AllExcluding(ByRef ParamArray IndexArray() As Variant) As ShapeRange
Parameters:
Name Type Description
IndexArray
Variant
Remarks:
The AllExcluding method returns a shape range that contains all the shapes (except any specified ones) from a Shapes collection. This function accepts a variable number of arguments. It also accepts arrays.
Examples:
The following VBA example deletes all the shapes in the Shapes collection, except the two shapes that were most recently created. To run this example, there must be at least three shapes on the active layer.
Sub Test()
With ActiveLayer.Shapes
  .AllExcluding(Array(1, 2)).Delete
  MsgBox "There are " & .Count & " shapes in the Shapes collection."
End With 
End Sub