Selecting Text in a Document
Use the Select method to select an item in a document. The Select method is available from several objects, such as Bookmark, Field, Range, and Table. The following example selects the first table in the active document.
Sub SelectTable()
ActiveDocument.Tables(1).Select
End Sub
The following example selects the first field in the active document.
Sub SelectField()
ActiveDocument.Fields(1).Select
End Sub
The following example selects the first four paragraphs in the active document. The Range method is used to create a Range object that refers to the first four paragraphs. The Select method is then applied to the Range object.
Sub SelectRange()
Dim rngParagraphs As Range
Set rngParagraphs = ActiveDocument.Range( _
Start:=ActiveDocument.Paragraphs(1).Range.Start, _
End:=ActiveDocument.Paragraphs(4).Range.End)
rngParagraphs.Select
End Sub
For more information, see Working with the Selection object.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.