Word) (Shape.ParentGroup 属性

返回一个 Shape 对象,该对象代表子形状或子形状范围的通用父形状。

语法

表达式ParentGroup

expression 是必需的。 一个代表 Shape 对象的变量。

示例

本示例在当前文档中创建两个形状,并将其组合。 然后使用组中的一个形状访问父组,并使用相同的填充颜色填充父组中的所有形状。 本示例假定当前文档目前不包含任何形状。 如果当前文档包含形状,可能会出现错误。

Sub ParentGroupShape() 
 Dim pgShape As Shape 
 
 'Add two shapes to active document and group 
 With ActiveDocument.Shapes 
 .AddShape Type:=msoShapeOval, Left:=72, _ 
 Top:=72, Width:=100, Height:=100 
 .AddShape Type:=msoShapeHeart, Left:=110, _ 
 Top:=120, Width:=100, Height:=100 
 .Range(Array(1, 2)).Group 
 End With 
 
 Set pgShape = ActiveDocument.Shapes(1) _ 
 .GroupItems(1).ParentGroup 
 pgShape.Fill.ForeColor.RGB = RGB(Red:=100, Green:=0, Blue:=255) 
 
End Sub

另请参阅

形状对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。