Select Method

Microsoft Publisher Visual Basic

Selects the specified object.

expression.Select

expression    Required. An expression that returns one of the above objects.

ShowSelect method as it applies to the Shape and ShapeRange objects.

Selects the specified object.

expression.Select(Replace)

expression    Required. An expression that returns one of the above objects.

Replace   Optional Variant. Specifies whether the selection replaces any previous selection. True to replace the previous selection with the new selection; False to add the new selection to the previous selection. Default is True.

Example

ShowAs it applies to the Cell, CellRange and TextRange objects.

This example selects the top left cell from a table that has been added to the first page in the active publication.

Dim shpTable As Shape
Dim cllTemp As Cell

With ActiveDocument.Pages(1).Shapes
    Set shpTable = .AddTable(NumRows:=3, NumColumns:=3, _
        Left:=100, Top:=100, Width:=150, Height:=150)
    Set cllTemp = shpTable.Table.Cells.Item(1)
    cllTemp.Select
End With
				

This example selects the first column from a table that has been added to the first page in the active publication.

Dim shpTable As Shape
Dim crTemp As CellRange

With ActiveDocument.Pages(1).Shapes
    Set shpTable = .AddTable(NumRows:=3, NumColumns:=3, _
        Left:=100, Top:=100, Width:=150, Height:=150)
    Set crTemp = shpTable.Table.Cells(StartRow:=1, _
        StartColumn:=1, EndRow:=3, EndColumn:=1)
    crTemp.Select
End With
				

This example selects the first five characters in shape one on page one of the active publication.

ActiveDocument.Pages(1).Shapes(1).TextFrame _
    .TextRange.Characters(1, 5).Select
				

ShowAs it applies to the Shape and ShapeRange objects.

This example selects shapes one and three on page one in the active publication.

ActiveDocument.Pages(1).Shapes.Range(Array(1, 3)).Select
				

This example adds shapes two and four on page one in the active publication to the previous selection.

ActiveDocument.Pages(1).Shapes.Range(Array(2, 4)) _
    .Select Replace:=False