Selection$()

Syntax

Selection$()

Remarks

Returns the plain, unformatted text of the selection. Selection$() can return as many as 65,280 characters or the maximum that available memory can hold. If the selection is too large, an error occurs and no text is returned. If no text is selected, Selection$() returns the character following the insertion point.

Example

This example selects the first heading in the document and then uses the Selection$() function to define the variable heading$ with the selected text:


StartOfDocument
EditFindClearFormatting
EditFindStyle .Style = "heading 1"
EditFind .Find = "", .WholeWord = 0, .MatchCase = 0, .Direction = 0, \
    .Format = 1, .Wrap = 0
If EditFindFound() <> 0 Then
    heading$ = Selection$()
End If

See Also

ExtendSelection, SelInfo(), SelType, ShrinkSelection