會傳回 Shape 物件,代表某個子圖案或某個範圍內所有子圖案的共同父圖案。
語法
表情。家長團體
需要 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 支援與意見反應。