VBA - Inserting & Deleting
Range.InsertParagraph
Replaces a Range or Selection with a new paragraph.
After this method has been used, the range or selection is the new paragraph.
If you don't want to replace the range or selection, use the Collapse method before using this method.
The InsertParagraphBefore method inserts a new paragraph before the range.
The InsertParagraphAfter method inserts a new paragraph after the range.
Range.InsertBefore
Inserts the specified text before the Range.
After the text is inserted, the range or selection is expanded to include the new text.
If the selection or 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.
Range.InsertAfter
Inserts the specified text after the Range
After the text is inserted, the range or selection expanded to include the new text.
You can insert characters such as quotation marks, tab characters, and nonbreaking hyphens by using the Visual Basic Chr function with the InsertAfter method.
If you use this method with a range or selection that refers to an entire paragraph, the text is inserted after the ending paragraph mark (the text will appear at the beginning of the next paragraph).
To insert text at the end of a paragraph, determine the ending point and subtract 1 from this location (the paragraph mark is one character), as shown in the following example.
This example inserts text at the end of the active document. The Content property returns a Range object.
This example inserts text from an input box as the second paragraph in the active document.
Insert text at start of document
or
or
Insert text to the end of a document
To insert text at the end of a document, you can collapse the range to the end using wdCollapseEnd
or
To refer to the insertion point immediately after the tenth character, set the character position to 10.
The end paragraph mark is actually counted as a character when you use:
In general
To insert text into a document without replacing existing text use a Range or Selection object that represents a single location (i.e. whose start and end points are equal).
This is easily obtained from an existing range, using the Collapse method
Deleting Text
This will remove the contents but preserve the range object.
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext