Use the Text property to return text from a Range or Selection object. The following example selects the next paragraph formatted with the Heading 1 style. The contents of the Text property are displayed by the MsgBox function.
With Selection.Find
.ClearFormatting
.Style = wdStyleHeading1
.Execute FindText:="", Format:=True, _
Forward:=True, Wrap:=wdFindStop
If .Found = True Then MsgBox Selection.Text
End With
The following instruction returns the selected text.
strText = Selection.Text
The following example returns the first word in the active document. Each item in the Words collection is a Range object that represents one word.
aFirst = ActiveDocument.Words(1).Text
MsgBox aFirst
The following example returns the text associated with the first bookmark in the active document.
If ActiveDocument.Bookmarks.Count >= 1 Then
bookText = ActiveDocument.Bookmarks(1).Range.Text
MsgBox bookText
End If