ParentGroup Property

Microsoft PowerPoint Visual Basic

expression.ParentGroup

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example creates two shapes on the first slide in the active presentation and groups those shapes; then using one shape in the group, accesses the parent group and fills all shapes in the parent group with the same fill color. This example assumes that the first slide of the active presentation does not currently contain any shapes. If it does, you will receive an error.

Sub ParentGroup()
    Dim sldNewSlide As Slide
    Dim shpParentGroup As Shape

    'Add two shapes to active document and group
    Set sldNewSlide = ActivePresentation.Slides _
        .Add(Index:=1, Layout:=ppLayoutBlank)

    With sldNewSlide.Shapes
        .AddShape Type:=msoShapeBalloon, Left:=72, _
            Top:=72, Width:=100, Height:=100
        .AddShape Type:=msoShapeOval, Left:=110, _
            Top:=120, Width:=100, Height:=100
        .Range(Array(1, 2)).Group
    End With

    Set shpParentGroup = ActivePresentation.Slides(1).Shapes(1) _
        .GroupItems(1).ParentGroup
    shpParentGroup.Fill.ForeColor.RGB = RGB _
        (Red:=151, Green:=51, Blue:=250)

End Sub