Shape.Child property (Word)
True 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.
expression.Child
expression Required. A variable that represents a Shape object.
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
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.