Share via


Text Property

Home Page (Objects)OverviewFAQReference

Applies to: TextSelection object

Gets or sets the text in a selection.

Syntax

object**.Text** [=text]

-or-

object [=text]

Parameters

object

An expression that evaluates to a TextSelection object.

text

A String that sets the text in the selection. This string can include one or both of the following values:

  • vbCrLf   Represents "\r\n"

  • vbTab   Represents "\t"

Remarks

The Text property has the String type.

The Text property is the default property of the TextSelection object. Accordingly, you can reference the TextSelection object without explicitly specifying ".Text," as shown in the syntax.

Note   You cannot use the Text property on text in a column selection.

Examples

The following example inserts a tab by using vbTab with the Text property:

Dim Sel
SetSel=ActiveDocument.Selection
Sel.Text=vbTab

Alternatively, you can use the document's Selection property:

Sel=ActiveDocument.Selection
Sel=vbTab

See Also   DestructiveInsert method, Indent method, NewLine method, Overtype property, Unindent method.