Bewerken

Delen via


ShapeRange.ParentGroup property (PowerPoint)

Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.

Syntax

expression.ParentGroup

expression A variable that represents a ShapeRange object.

Return value

Shape

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

See also

ShapeRange Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.