Share via


Editor.Range Property

Word Developer Reference

Returns a Range object that represents the portion of a document that is contained in the specified object.

Syntax

expression.Range

expression   Required. A variable that represents an Editor object.

Remarks

For information about returning a range from a document or returning a shape range from a collection of shapes, see the Range method.

Example

This example applies the Heading 1 style to the first paragraph in the active document.

Visual Basic for Applications
  ActiveDocument.Paragraphs(1).Range.Style = wdStyleHeading1

This example copies the first row in table one.

Visual Basic for Applications
  If ActiveDocument.Tables.Count >= 1 Then _
    ActiveDocument.Tables(1).Rows(1).Range.Copy

This example changes the text of the first comment in the document.

Visual Basic for Applications
  With ActiveDocument.Comments(1).Range
    .Delete
    .InsertBefore "new comment text"
End With

This example inserts text at the end of section one.

Visual Basic for Applications
  Set myRange = ActiveDocument.Sections(1).Range
With myRange
    .MoveEnd Unit:=wdCharacter, Count:=-1
    .Collapse Direction:=wdCollapseEnd
    .InsertParagraphAfter
    .InsertAfter "End of section"
End With

See Also