Class Rectangles (Word VBA)
A collection of Rectangle objects in a page that represent portions of text and graphics. Use the Rectangles collection and related objects and properties for programmatically defining page layout in a document. To use a Rectangles class variable it first needs to be instantiated, for example
For Each
Here is an example of processing the Rectangles items in a collection.
Dim lin As Line: Set lin =
Dim shp As Rectangle
For Each shp In lin.Rectangles
With shp
End With
Next shp
Count
Returns a Long that represents the number of rectangles in the collection.
Dim rcts As Rectangles: Set rcts =
Dim lngCount As Long
lngCount = rcts.Count
Item
Returns an individual Rectangle object in a collection.
Item (Index)
Index: The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.
Dim rcts As Rectangles: Set rcts =
Dim shp As Rectangle
Set shp = rcts(Index:=1)