ShrinkDiscontiguousSelection Method

Microsoft Word Visual Basic

ShrinkDiscontiguousSelection Method

       

Deselects all but the most recently selected text when a selection contains multiple, unconnected selections.

expression.ShrinkDiscontiguousSelection

expression   Required. An expression that returns a Selection object.

Example

This example deselects all but the most recently selected text and formats with bold and small caps the text remaining in the selection. This example assumes there are multiple selections in the document.

Sub ShrinkMultipleSelection()
    With Selection
        .ShrinkDiscontiguousSelection
        .Font.Bold = True
        .Font.SmallCaps = True
    End With
End Sub