Child Property

Microsoft Word Visual Basic

MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse
msoTriStateMixed
msoTriStateToggle
msoTrue

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 document is a drawing canvas that contains multiple shapes.

Sub FillChildShape()

    Dim shpCanvasItem As Shape
    
    'Select the first shape in the drawing canvas
    Set shpCanvasItem = ActiveDocument.Shapes(1).CanvasItems(1)

    'Fill selected shape if it is a child shape
    With shpCanvasItem
        If .Child = msoTrue Then
            .Fill.ForeColor.RGB = RGB(100, 0, 200)
        Else
            MsgBox "This shape is not a child shape."
        End If
    End With

End Sub