ShapeRange.ParentGroup Property
Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.
Namespace: Microsoft.Office.Interop.PowerPoint
Assembly: Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)
Syntax
'Declaration
ReadOnly Property ParentGroup As Shape
Get
'Usage
Dim instance As ShapeRange
Dim value As Shape
value = instance.ParentGroup
Shape ParentGroup { get; }
Property Value
Type: Microsoft.Office.Interop.PowerPoint.Shape
Shape
Examples
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).ParentGroupshpParentGroup.Fill.ForeColor.RGB = RGB _
(Red:=151, Green:=51, Blue:=250)
End Sub