共用方式為


PowerPoint) (Selection.ChildShapeRange 屬性

會傳回 ShapeRange 物件,表示選取範圍的子圖案。

語法

expressionChildShapeRange

表達 代表 Selection 物件的變數。

傳回值

ShapeRange

範例

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

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 支援與意見反應