This documentation is archived and is not being maintained.

TextRanges Collection

Visual Studio .NET 2003

Contains a TextRange Object for each of the tagged subexpressions from a search pattern. Also used for finding where a box selection intersects each line of text.






[Visual Basic .NET]
Public Interface TextRanges
    Inherits IDispatch
[Visual Basic 6]
Class TextRanges
interface TextRanges : IDispatch
public interface TextRanges : IDispatch
[JScript .NET]
public interface TextRanges extends IDispatch


A TextRanges collection is returned from a search operation when the search pattern is a regular expression with tagged subexpressions. The TextRanges collection contains a TextRange object for each of the tagged subexpressions.

Also, TextRanges are used to get box selections from the TextSelection Object if you need to find out where the box selection intersects each line.


Sub TextRangesExample()
   Dim objTxtSel As TextSelection
   Dim colRanges As TextRanges
   Dim objRange As TextRange
   Dim objEP As EditPoint

   Set objTxtSel = ActiveDocument.Selection
   Set colRanges = objTxtSel.TextRanges
   For Each objRange In colRanges
      objRange.StartPoint.Insert "/*"
      objRange.EndPoint.Insert "*/"
End Sub

See Also

Properties, Methods, and Events | TextRange Object | TextSelection Object