GroupShapes 集合对象

         
Shapes (Shape)
GroupShapes (Shape)

代表形状组中的单个形状。每个形状由一个 Shape 对象代表。对本对象使用 Item 方法,就可以使用形状组中的单个形状而无须对它们取消组合。

使用 Groupshapes 集合

使用 GroupItems 属性返回 GroupShapes 集合。使用 GroupItems(index) 返回 GroupShapes 集合中的单个形状,其中 index 是组合形状中单个形状的数目。以下示例向 myDocument 中添加三个三角形,将它们组合并设置整个组的颜色,然后只更改第二个三角形的颜色。

Set myDocument = ActivePresentation.Slides(1)
With myDocument.Shapes
    .AddShape(msoShapeIsoscelesTriangle, 10, _
        10, 100, 100).Name = "shpOne"
    .AddShape(msoShapeIsoscelesTriangle, 150, _
        10, 100, 100).Name = "shpTwo"
    .AddShape(msoShapeIsoscelesTriangle, 300, _
        10, 100, 100).Name = "shpThree"
    With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
        .Fill.PresetTextured msoTextureBlueTissuePaper
        .GroupItems(2).Fill.PresetTextured msoTextureGreenMarble
    End With
End With