Selected Property

Microsoft Publisher Visual Basic

Returns or sets an MsoTriState constant that represents whether a Web check box or option button is selected. Read/write.

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

expression.Selected

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

ShowSelected property as it applies to the Cell object.

True if a cell is selected. Read-only Boolean.

expression.Selected

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

Example

ShowAs it applies to the WebCheckBox object.

This example adds a new Web check box to the first page of the active publication and then selects it.

Sub AddNewWebCheckBox()
    With ActiveDocument.Pages(1).Shapes.AddWebControl _
            (Type:=pbWebControlCheckBox, Left:=100, _
            Top:=100, Width:=100, Height:=12)
        .WebCheckBox.Selected = msoTrue
    End With
End Sub
				

ShowAs it applies to the Cell object.

This example determines if a cell in the specified table is selected and if it is, enters text into the cell.

Sub IsCellSelected()
    Dim cel As Cell
    With ActiveDocument.Pages(1).Shapes(1).Table
        For Each cel In .Cells
            If cel.Selected Then
                cel.TextRange.Text = "This cell is selected."
            End If
        Next cel
    End With
End Sub