SentRight, SentRight()

Syntax

SentRight [Count,] [Select]

SentRight([Count,] [Select])

Remarks

The SentRight statement moves the insertion point or the active end of the selection (the end that moves when you press SHIFT+an arrow key) to the right by the specified number of sentences.

Argument

Explanation

Count

The number of sentences to move; if less than one or omitted, 1 is assumed.

Select

Specifies whether to select text:

0 (zero) or omitted Text is not selected. If there is already a selection, SentRight moves the insertion point Count–1 sentences to the right of the selection.

Nonzero Text is selected. If there is already a selection, SentRight moves the active end of the selection toward the end of the document.

In a typical selection made from left to right, where the active end of the selection is closer to the end of the document, SentRight extends the selection. In a selection made from right to left, it shrinks the selection.


Note that Word counts empty table cells as "sentences," and that, regardless of length or punctuation, Word considers every paragraph to contain at least one sentence.

The SentRight() function behaves the same as the statement and also returns the following values.

Value

Explanation

0 (zero)

If the insertion point or the active end of the selection cannot be moved to the right.

–1

If the insertion point or the active end of the selection is moved to the right by any number of sentences, even if less than Count. For example, SentRight(10) returns –1 even if the insertion point is only three sentences from the end of the document.


Example

This example counts the number of sentences in the document (excluding paragraph marks) and displays the result in a message box:


StartOfDocument
count = 0
While SentRight(1, 1) <> 0
    If Right$(Selection$(), 1) <> Chr$(13) Then count = count + 1
Wend
MsgBox "Number of sentences in document:" + Str$(count)

See Also

CharRight, EndOfLine, ParaDown, SelectCurSentence, SentLeft, WordRight