Skip to content

Files

Latest commit

author
Docs Allowlist Management
Mar 22, 2024
76d3237 · Mar 22, 2024

History

History
57 lines (36 loc) · 1.22 KB

Excel.Shape.ParentGroup.md

File metadata and controls

57 lines (36 loc) · 1.22 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Shape.ParentGroup property (Excel)
vbaxl10.chm636139
vbaxl10.chm636139
Excel.Shape.ParentGroup
6c43979d-fe16-4093-9eb2-78863230e6d2
05/14/2019
medium

Shape.ParentGroup property (Excel)

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 Shape object.

Example

In this example, Microsoft Excel adds two shapes to the active worksheet and then removes both shapes by deleting the parent shape of the group.

Sub ParentGroup() 
 
 Dim pgShape As Shape 
 
 With ActiveSheet.Shapes 
 .AddShape Type:=1, Left:=10, Top:=10, _ 
 Width:=100, Height:=100 
 .AddShape Type:=2, Left:=110, Top:=120, _ 
 Width:=100, Height:=100 
 .Range(Array(1, 2)).Group 
 End With 
 
 ' Using the child shape in the group get the Parent shape. 
 Set pgShape = ActiveSheet.Shapes(1).GroupItems(1).ParentGroup 
 
 MsgBox "The two shapes will now be deleted." 
 
 ' Delete the parent shape. 
 pgShape.Delete 
 
End Sub

[!includeSupport and feedback]