Object Model Reference : Classes : S : ShapeRange : Properties : ShapeRange.Item |
Property Item(IndexOrName As Variant) As Shape
Member of ShapeRange
The Item property returns a specified shape in a shape range. It is the default property of the ShapeRange class.
The Item property returns a read-only value.
The following VBA example finds the shape named MyRectangle from the selection and fills it with a uniform red fill.
Sub Test() |
ActiveSelectionRange("MyRectangle").Fill.UniformColor.RGBAssign 255, 0, 0 |
End Sub |
The following VBA 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 VBA 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 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 2013 Corel Corporation. All rights reserved.