Share via


Range.InsertBefore Method

Word Developer Reference

Inserts the specified text before the specified range.

Syntax

expression.InsertBefore(Text)

expression   Required. A variable that represents a Range object.

Parameters

Name Required/Optional Data Type Description
Text Required String The text to be inserted.

Remarks

After the text is inserted, the range is expanded to include the new text. If the range is a bookmark, the bookmark is also expanded to include the next text.

You can insert characters such as quotation marks, tab characters, and nonbreaking hyphens by using the Visual Basic Chr function with the InsertBefore method. You can also use the following Visual Basic constants: vbCr, vbLf, vbCrLf and vbTab.

Example

This example inserts the text "Introduction" as a separate paragraph at the beginning of the active document.

Visual Basic for Applications
  With ActiveDocument.Content
    .InsertParagraphBefore
    .InsertBefore "Introduction"
End With

See Also