Hi Ken,
I ran your code in a macro and saw the same thing. I also saw something else
that you didn't mention. In the cells where the last sentence was displayed,
it was followed by a bullet symbol on a new line.
Let's focus on my second observation first. After some playing around, I
came to the conclusion that a sentence (an element in the Sentences
collection) is represented by a range (Range object) whose end is indicated
by the presence of sentence-terminating punctuation (for example, a period)
followed by white space. In the case of a table, the cell boundaries and row
boundaries are treated as white-space characters. Thus, the Range of the last
sentence in the cell at the end of a row includes two extra characters: one
that terminates the cell and one that terminates the row. In the cells that
are not at the end of a row, the Range of the last sentence includes only the
bullet-producing character that terminates the cell. In my opinion, all the
white-space characters between sentences should be not be included in the
sentences extracted from the table. By excluding them, the extra bullets are
eliminated.
Now let's discuss your original observation. For some reason, Word is
setting the boundaries of the Range of the last sentence in a cell at the end
of a row to include only the white space at its end. The solution to this
problem is to save the position of the start of the cell, set the starting
position of the Range for the first sentence in the cell to that position,
and then set the starting position of each additional sentence to the ending
position of the Range of the previous sentence.
The following macro includes all of these changes and works fine for me.
Sub ParseTableCells()
Dim rTable As table
Dim rnge As Range
Dim sentx As Range
Dim i, j, k As Integer
Dim pos As Integer
Set rTable = ActiveDocument.Tables(1)
For i = 1 To rTable.Rows.Count
For j = 1 To rTable.Columns.Count
Set rnge = rTable.Cell(i, j).Range
' Save the starting position of the cell.
pos = rnge.Start
For Each sentx In rnge.Sentences
sentx.Start = pos
pos = sentx.End
' Remove unwanted white space characters.
If j = rTable.Columns.Count Then
sentx.MoveEnd Unit:=wdCharacter, Count:=-2
Else
sentx.MoveEnd Unit:=wdCharacter, Count:=-1
End If
MsgBox sentx.Text
Next
Next
Next i
End Sub