Share via


GroupShapes Collection

GroupShapes Collection
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.


Aa661997.parchild(en-us,office.10).gifGroupShapes
Aa661997.space(en-us,office.10).gifAa661997.parchild(en-us,office.10).gifShape

Represents the individual shapes within a grouped shape. Each shape is represented by a Shape object. Using the Item method with this object, you can work with single shapes within a group without having to ungroup them.

Using The Groupshapes Collection

Use the GroupItems property to return a GroupShapes collection. Use GroupItems(index), where index is the number of the individual shape within the grouped shape, to return a single shape from the GroupShapes collection. The following example adds three triangles to the active document, groups them, sets a color for the entire group, and then changes the color for the third triangle only.

  Sub WorkWithGroupShapes()
    With ActiveDocument.Pages.Add(Count:=1, After:=1).Shapes
        .AddShape(msoShapeIsoscelesTriangle, _
            50, 50, 100, 100).Name = "shpOne"
        .AddShape(msoShapeIsoscelesTriangle, _
            200, 50, 100, 100).Name = "shpTwo"
        .AddShape(msoShapeIsoscelesTriangle, _
            350, 50, 100, 100).Name = "shpThree"
        With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
            .Fill.PresetTextured PresetTexture:=msoTextureBlueTissuePaper
            .GroupItems(3).Fill.PresetTextured _
                PresetTexture:=msoTextureGreenMarble
        End With
    End With
End Sub