A Range object specifies an area in a document. Once you have created a Range object, you can insert text, tables, and paragraphs into a document.
You can use the Range method from the Document object to specify a range in a document. You can specify the beginning and ending characters of the range.
{Specify a range that includes the first ten characters in a document.} wordRange = document.Range(0,10);
If you do not specify beginning or ending characters, the returned range is the entire document. |
You can also use the Range property from a Paragraph object, a Cell object, or a Table object to specify a range. The returned Range object spans from the beginning to the end of the object associated with the property.
{Creates a range that spans a paragraph.} wordRange = paragraph.Range;
To insert text before a range, use the InsertBefore method.
{Insert "Customer List" before a range.} wordRange.InsertBefore("Customer List");
To insert text after a range, use the InsertAfter method.
{Insert "Customer Name" after the range.} wordRange.InsertAfter("Customer Name");
If you are inserting text after a range retrieved from a Paragraph object, the text becomes part of the next paragraph. |