By Allen Wyatt for Word.Tips.Net
Selecting Sentences in Word
Word does not provide function keys for you to step through your document one sentence at a time. If you are used to a different word processor, you may consider such a capability rather important. The following macro, StepRightSentence, provides the capability to step through a document one sentence at a time toward the right. You can assign the macro either to a shortcut key or to a toolbar button.
Sub StepRightSentence()
If Selection.Type <> wdNoSelection Then
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdMove
End If
Selection.Sentences(1).Next(Unit:=wdSentence, Count:=1).Select
End Sub
If you want to use Word to step through a document toward the left (beginning of the document), you can use the following macro, StepLeftSentence:
Sub StepLeftSentence()
If Selection.Type <> wdNoSelection Then
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdMove
End If
Selection.Sentences(1).Previous(Unit:=wdSentence, Count:=1).Select
End Sub
Regardless of which of these macros you use, the result is that you step through your document, one sentence at a time. After running the macro, the next sentence—left or right—is selected. If you instead want to only jump to the beginning of the sentence, without selecting it, add the following line as the final line in the macro, just before the End Sub statement:
Selection.Collapse Direction:=wdCollapseStart
This post is excerpted with permission from Word.Tips.Net
Subscribe to the Free WordTips Newsletter with the links below
(for those using menu interface (Word 97, Word 2000, Word 2002, or Word 2003)