GetSelEndPos()

Syntax

GetSelEndPos()

Remarks

Returns the character position of the end of the selection relative to the start of the document, which has a character position of 0 (zero). The end of the selection is defined as the end farthest from the start of the document. All characters, including nonprinting characters, are counted. Hidden characters are counted even if they are not displayed.

Example

This macro displays a message box if there is no selection. The user-defined function checksel compares the character positions at the start and end of the selection. If the positions are equal, indicating there is no selection, the function returns 0 (zero) and the message box is displayed.


Sub MAIN
    If checksel = 0 Then MsgBox "There is no selection."
End Sub

Function checksel
    If GetSelStartPos() = GetSelEndPos() Then
        checksel = 0
    Else
        checksel = 1
    End If
End Function

See Also

GetSelStartPos(), GetText$(), SetSelRange