Class GroupShapes (Word VBA)

The class GroupShapes represents the individual shapes within a grouped shape. Each shape contained within a group of shapes is represented by a Shape object. To use a GroupShapes class variable it first needs to be instantiated, for example

Count

Returns a Long that represents the number of shapes in the collection.


Dim gss As GroupShapes: Set gss =  
Dim lngCount As Long
lngCount = gss.Count

Item

Returns an individual Shape object in a collection.

Item (Index)

Index: The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.


Dim gss As GroupShapes: Set gss =  
Dim shpGroupShape As Shape
Set shpGroupShape = gss(Index:=1)

Range

Returns a ShapeRange object.

ShapeRange objects don't include InlineShape objects. An InlineShape object is equivalent to a character and is positioned as a character within a range of text. Shape objects are anchored to a range of text (the selection, by default), but they can be positioned anywhere on the page. A Shape object will always appear on the same page as the range it is anchored to. Most operations that you can do with a Shape object you can also do with a ShapeRange object that contains a single shape. Some operations, when performed on a ShapeRange object that contains multiple shapes, produce an error.

Range (Index)

Index: Specifies which shapes are to be included in the specified range. Can be an integer that specifies the index number of a shape within the Shapes collection, a string that specifies the name of a shape, or a array that contains integers or strings.


Sub ShRange() 
 With ActiveDocument.Shapes.Range(1).Fill 
 .ForeColor.RGB = RGB(255, 0, 255) 
 .Visible = msoTrue 
 End With 
End Sub