Word) (Selection.HasChildShapeRange 屬性
True 是表示 如果選取範圍包含子圖形。 唯讀的 Boolean。
語法
expression。 HasChildShapeRange
表達 會傳回 Selection 物件的運算式。
範例
本範例會建立具有繪圖畫布的新文件、將圖案放入繪圖畫布中,然後在檢查圖案為子圖案之後,填入子圖案的圖樣。
Sub ChildShapes()
Dim docNew As Document
Dim shpCanvas As Shape
'Create a new document with a drawing canvas and shapes
Set docNew = Documents.Add
Set shpCanvas = docNew.Shapes.AddCanvas( _
Left:=100, Top:=100, Width:=200, Height:=200)
shpCanvas.CanvasItems.AddShape msoShapeRectangle, _
Left:=0, Top:=0, Width:=100, Height:=100
shpCanvas.CanvasItems.AddShape msoShapeOval, _
Left:=0, Top:=50, Width:=100, Height:=100
shpCanvas.CanvasItems.AddShape msoShapeDiamond, _
Left:=0, Top:=100, Width:=100, Height:=100
'Select all shapes in the canvas
shpCanvas.CanvasItems.SelectAll
'Fill canvas child shapes with a pattern
If Selection.HasChildShapeRange = True Then
Selection.ChildShapeRange.Fill.Patterned msoPatternDivot
Else
MsgBox "This is not a range of child shapes."
End If
End Sub
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。