Share via


Propiedad Shape.ParentGroup (Excel)

Devuelve un objeto Shape que representa la forma primaria común de una forma secundaria o un intervalo de formas secundarias.

Sintaxis

expresión. ParentGroup

Expresión Variable que representa un objeto Shape .

Ejemplo:

En este ejemplo, Microsoft Excel agrega dos formas a la hoja de cálculo activa y luego las quita eliminando la forma primaria del grupo.

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

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.