Selection.ChildShapeRange Property
Returns a ShapeRange object that represents the child shapes of a selection.
Namespace: Microsoft.Office.Interop.PowerPoint
Assembly: Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)
Syntax
'Declaration
ReadOnly Property ChildShapeRange As ShapeRange
Get
'Usage
Dim instance As Selection
Dim value As ShapeRange
value = instance.ChildShapeRange
ShapeRange ChildShapeRange { get; }
Property Value
Type: Microsoft.Office.Interop.PowerPoint.ShapeRange
ShapeRange
Examples
This example creates a new document with a drawing canvas, populates the drawing canvas with shapes, and selects the shapes added to the canvas. Then after checking that the shapes selected are child shapes, it fills the child shapes with a pattern.
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