![]() |
![]() |
ShapeRange.Item
Property Item(IndexOrName As Variant) As Shape
Member of ShapeRange
The Item property returns the specified ShapeRange.
The Item property is the default property and its reference can be omitted when referencing items in the collection. For example, ShapeRange.Item(2)
is the same as ShapeRange(2)
they both reference the second shape object in the ShapeRange collection.
The Item property returns a read-only value.
The following code example finds the shape named MyRectangle
from the selection and fills it with a uniform red fill:
The following code example fills every ellipse on the active page with a uniform blue fill:
Sub Test() Dim i As Long Dim sr As ShapeRange Set sr = ActivePage.FindShapes(Type:=cdrEllipseShape) For i = 1 To sr.Count sr(i).Fill.UniformColor.RGBAssign 0, 0, 255 Next i End Sub
The following code example performs the same procedure as the previous example. However, instead of using a For Next command, it uses the For Each command in Visual Basic to iterate through all of the shapes in the collection.
Sub Test() Dim s As Shape Dim sr As ShapeRange Set sr = ActivePage.FindShapes(Type:=cdrEllipseShape) For Each s In sr s.Fill.UniformColor.RGBAssign 0, 0, 255 Next s End Sub
![]() |
![]() |
![]() |
Copyright 2007 Corel Corporation. All rights reserved.