共用方式為


PowerPoint) (Selection.HasChildShapeRange 屬性

True 是表示 如果選取範圍包含子圖形。 唯讀。

語法

expressionHasChildShapeRange

表達 代表 ParagraphFormat 物件的 變數。

傳回值

布林值

範例

本範例會建立具有繪圖畫布的新投影片、將圖案填入繪圖畫布中,以及選取新增至畫布的圖案。 然後在檢查選取的圖案是否為子圖案之後,填入子圖案的圖樣。

Sub ChildShapes()

    Dim sldNew As Slide
    Dim shpCanvas As Shape

    'Create a new slide with a drawing canvas and shapes
    Set sldNew = Presentations(1).Slides _
        .Add(Index:=1, Layout:=ppLayoutBlank)

    Set shpCanvas = sldNew.Shapes.AddCanvas( _
        Left:=100, Top:=100, Width:=200, Height:=200)

    With shpCanvas.CanvasItems
        .AddShape msoShapeRectangle, Left:=0, Top:=0, _
            Width:=100, Height:=100
			
        .AddShape msoShapeOval, Left:=0, Top:=50, _
            Width:=100, Height:=100

        .AddShape msoShapeDiamond, Left:=0, Top:=100, _
            Width:=100, Height:=100

    End With

    'Select all shapes in the canvas
    shpCanvas.CanvasItems.SelectAll

    'Fill canvas child shapes with a pattern
    With ActiveWindow.Selection
        If .HasChildShapeRange = True Then
            .ChildShapeRange.Fill.Patterned Pattern:=msoPatternDivot
        Else
            MsgBox "This is not a range of child shapes."
        End If
    End With
	
End Sub

另請參閱

Selection 物件

支援和意見反應

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