Range.InsertBefore method (Word)
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.
With ActiveDocument.Content
.InsertParagraphBefore
.InsertBefore "Introduction"
End With
See also
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.