SelectAll Method

Microsoft Word Visual Basic

SelectAll Method

       

Selects all the shapes in the main story, in a canvas, or in headers and footers of a document.

expression.SelectAll

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

Remarks

This method doesn't select InlineShape objects.

Example

This example selects all the shapes in the active document.

Sub SelectAllShapes()
    ActiveDocument.Shapes.SelectAll
End Sub

This example selects all the shapes in the headers and footers of the active document and adds a red shadow to each shape.

Sub SelectAllHeaderShapes()
    With ActiveDocument.ActiveWindow
        .View.Type = wdPrintView
        .ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End With

    ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes.SelectAll

    With Selection.ShapeRange.Shadow
        .Type = msoShadow10
        .ForeColor.RGB = RGB(220, 0, 0)
    End With
End Sub

This example selects and deletes all the shapes inside the first canvas of the active document.

Sub SelectCanvasShapes()
    Dim s As Shape
    Set s = ActiveDocument.Shapes.Range(1)
    s.CanvasItems.SelectAll
    Selection.Delete
End Sub