共用方式為


Shape.ParentGroupShape 屬性 (Publisher)

會傳回 Shape 物件,代表某個子圖案或某個範圍內所有子圖案的共同父圖案。

語法

運算式ParentGroupShape

表達 代表 Shape 物件的變數。

傳回值

圖形

範例

本範例會在使用中文件內建立兩個圖案並群組這兩個圖案。 在群組中使用一個圖形,即可存取父群組,並以相同的填滿模式填滿父群組中的所有圖形。 本範例假設使用中文件目前並未包含任何圖案。 否則可能發生錯誤。

Sub ParentGroupShape() 
 Dim shpGroup As Shape 
 
 With ActiveDocument.Pages(1).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 shpGroup = ActiveDocument.Pages(1).Shapes(1) _ 
 .GroupItems(1).ParentGroupShape 
 shpGroup.Fill.Patterned Pattern:=msoPattern25Percent 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應