Child Property

Microsoft PowerPoint Visual Basic

Show All

Child Property

       

MsoTrue if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Does not apply to this property.
msoFalse The shape is not a child shape or, if a shape range, all child shapes do not belong to the same parent.
msoTriStateMixed Does not apply to this property.
msoTriStateToggle Does not apply to this property.
msoTrue The shape is a child shape or, if a shape range, all child shapes belong to the same parent.

expression.Child

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

This example selects the first shape in the canvas, and if the selected shape is a child shape, fills the shape with the specified color.  This example assumes that the first shape in the active presentation is a drawing canvas that contains multiple shapes.

Sub FillChildShape()

    'Select the first shape in the drawing canvas
    ActivePresentation.Slides(1).Shapes(1).CanvasItems(1).Select

    'Fill selected shape if it is a child shape
    With ActiveWindow.Selection

        If .ShapeRange.Child = msoTrue Then
            .ShapeRange.Fill.ForeColor.RGB = RGB(Red:=100, Green:=0, Blue:=200)
        Else
            MsgBox "This shape is not a child shape."
        End If

    End With

End Sub