ShapeRange.Child property (Excel)

Returns msoTrue if the specified shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Returns msoFalse if the selected shape is not a child shape. Returns msoTriStateMixed if only some of the selected shapes are child shapes. Read-only MsoTriState.

Syntax

expression.Child

expression A variable that represents a ShapeRange object.

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 a drawing canvas contains multiple shapes on the active worksheet.

Sub FillChildShape() 
 
    'Select the first shape in the drawing canvas. 
    ActiveSheet.Shapes(1).CanvasItems(1).Select 
 
    'Fill selected shape if it is a child shape. 
    If Selection.ShapeRange.Child = msoTrue Then 
        Selection.ShapeRange.Fill.ForeColor.RGB = RGB(100, 0, 200) 
    Else 
        MsgBox "This shape is not a child shape." 
    End If 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.