Class Sentences (Word VBA)

A collection of Range objects that represent all the sentences in a selection, range, or document. There is no Sentence object. To use a Sentences class variable it first needs to be instantiated, for example


Dim snts as Sentences
Set snts = ActiveDocument.Sentences

Count

Returns a Long that represents the number of sentences in the collection.


Dim lngCount As Long
lngCount = ActiveDocument.Sentences.Count

First

Returns a Range object that represents the first sentence in a collection of sentences within a document, range, or selection.


Dim rngFirst As Range
Set rngFirst = ActiveDocument.Sentences.First

Item

Returns an individual Range object in a collection.

Item (Index)

Index: The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.


Dim rngSentence As Range
Set rngSentence = ActiveDocument.Sentences(Index:=1)

Last

Returns a Range object that represents the last sentence in a document, selection, or range.


Dim rngLast As Range
Set rngLast = ActiveDocument.Sentences.Last