Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting the active sentence

Status
Not open for further replies.

RockIt

MIS
Apr 23, 2002
4
GB
Hey all,
How do you just select the active sentence in a word document using VBA? I see the document.sentences.item(???).select method. But how do I know my item number?

Thanks In Advance.

Rockit
 
Just selecting the sentence with the insertion point in it:

If Selection.Type = wdSelectionIP Then
Selection.Sentences(1).Select
End If

Caveat: Word's idea of a sentence includes the spaces between this sentence and the next. This may be more than one, or something you do not want at all. Also, if the sentence is the last sentence of a paragraph, the paragraph mark will be included in the selection plus any following "empty" paragraph marks.


IS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top