This documentation is archived and is not being maintained.

Document.Range Method

Returns a Microsoft.Office.Interop.Word.Range by using the specified starting and ending character positions.

Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in

public virtual Range Range (
	[OptionalAttribute] ref Object Start,
	[OptionalAttribute] ref Object End



The starting character position.


The ending character position.

Return Value

A Microsoft.Office.Interop.Word.Range that uses the specified starting and ending character positions.

Optional Parameters

For information on optional parameters, see Understanding Optional Parameters in COM Interop.

The following code example uses the Range method to add the string "This is a line of text" to the current document, and then gets a Microsoft.Office.Interop.Word.Range that includes only the first seven letters of the string.

private void DocumentRange()
    // Add a string to the document.
    object start = 0;
    object end = 0;
    string newText = "This is a line of text. ";
    Word.Range range1 = this.Range(ref start, ref end);
    range1.Text = newText;

    // Display only the first seven characters in the string.
    end = 7;
    Word.Range range2 = this.Range(ref start, ref end);
    MessageBox.Show("The first seven characters: " +