If a cell contains the following:
abcdefg
123456
!"£$%^
I would like returned abcdefg, but not to have
123456
!"£$%^
Is each line a different paragraph? (A "paragraph" includes any line -- even
an empty line -- which ends with a paragraph mark.)
Sub FindFirstLineOfCell()
Dim nIndex As Long
Dim nTables As Long
nTables = ActiveDocument.Tables.Count
If nTables > 0 Then
For nIndex = 1 To nTables
sStr = ActiveDocument.Tables(nIndex).Cell(1, 1).Range.Text
sStr = Left(sStr, InStr(sStr, vbCr) - 1)
MsgBox "First line of Cell(1,1) = " & sStr
Next nIndex
End If
End Sub
While each cell ends with a Carriage Return and Line Feed, each paragraph
before the last line of a cell merely ends with a paragraph mark.
The line: sStr = Left(sStr, InStr(sStr, vbCr) - 1) returns the left part of
the string before the first paragraph mark.
If that doesn't work for you, we can look for the first word in a cell, or
the first word without a digit in the cell, or something distinctive.
Steven Craig Miller