|
 |  | Range
|
Range Object
See also: Using the Range Object.
| |

 |
Begin property, read-only, Object.
Returns an empty (collapsed) Range object that represents the starting position of the specified range.
|

| |

 |
Copy method.
Copies the contents of the specified range to the Clipboard.
This example copies the first node in the document and pastes it at the end of the document.
Document.RootNodes(1).Range.Copy
Document.Range.End.Paste
|
|

| |

 |
Cut method.
Removes the contents of the specified range from the document and places it on the Clipboard.
The collapsed range object remains in the document.
|

| |

 |
Delete method.
Removes the contents of the specified range from the document.
The collapsed range object remains in the document. After a range is deleted, the starting and ending positions are equal.
|

| |

 |
End property, read-only, Object.
Returns an empty (collapsed) Range object that represents the ending position of the specified range.
|

| |

 |
FindText method, ( String As String, [Flags] ) As Object.
FindText searches the range for a specified string. If the string is found, FindText return a Range object that represents the found portion of the document. Otherwise, the method returns Nothing.
String A String that represents the string you want to find.
Flags (Optional) A string constant of type VpSearchOptions that determines how to conduct the search. To perform complex searches, you can combine values. The values you can use singly or in combination are:
| vpMatchForward = 0 | Starts a forward search. This is the default. |
| vpMatchBackward = 1 | Starts a backward search. |
| vpMatchWord = 2 | Requires that whole words match. |
| vpMatchCase = 4 | Requires a case-sensitive match. |
| vpMatchRegExp = 8 | Requires a match with VrmlPad regular expressions. |
You can combine values in the Flags parameter by using the Or or concatenation (+) operators. For example, to conduct a case-sensitive forward search, you could specify vpMatchForward Or vpMatchCase or vpMatchForward + vpMatchCase.
The following VBScript example conducts a case-sensitive search for the word "field".
Dim rgn
Set rgn = Selection.FindText("field", vpMatchCase + vpMatchWord)
If Not rgn Is Nothing Then rgn.Select
|
|

| |

 |
FromLine property, read/write, Long.
Gets or sets the starting line of the specified range.
If this property is set to a value larger than the ToLine property, the ToLine property is set to the same value (that is, the FromLine and ToLine property are equal).
If this property is set to -1, the starting line of the range is set to the last line in the file.
|

| |

 |
FromRow property, read/write, Long.
Gets or sets the starting column of the specified range.
If this property is set to a value larger than the ToRow property, the ToRow property is set to the same value (that is, the FromRow and ToRow property are equal).
If this property is set to -1, the starting column is set to the last column of the starting line of the range.
|

| |

 |
Indent method, ( [Count] ).
Indent all lines in the specified range.
This method indents the contents of the range by the number specified in the Count (by default one). The Indent method affects all lines whether they are completely or partially within the range.
|

| |

 |
InRange property, read-only, ( Range As Object ) As Boolean.
Returns True if the range to which the property is applied is contained in the range specified by the Range argument.
The following VBScript example determines whether the selection is contained in the first node of the document.
status = Selection.InRange(RootNodes(1).Range)
|
|

| |

 |
IsEmpty property, read-only, Boolean.
Returns True, if the specified range is collapsed, that is the starting and ending positions are equal.
|

| |

 |
MoveTo method, ( Line As Long, Row As Long, [Extend] ).
Collapses and moves, or extends the range to the specified position.
Line A Long specifying the line number (from 1 to the number of lines in the file). Special value -1 means the last line in the file.
Row A Long specifying the column number (from 1). Special value -1 means the end of line.
Extend (Optional) A Boolean that indicates whether to extend selection up to the specified position, instead of move (False by default).
The following example moves the insertion point (caret) to the end of the document.
Dim MyRange As Range
Set MyRange = Document.Range
MyRange.MoveTo -1, -1
MyRange.Select
|
|

| |

 |
Paste method.
Inserts the contents of the Clipboard at the specified range. If the range is not empty, the previous contents of the range is deleted.
When this method is used, the range doesn't expand to include the Clipboard contents; instead, the range is positioned after the pasted Clipboard contents.
|

| |

 |
ReplaceText method, ( CurrString As String, RepString As String, [Flags] ) As Boolean.
Replaces inside the range all instances of a string or regular expression with another string or regular expression. Returns True, if one or more replacements occur, False otherwise.
CurrString The String you want to replace.
RepString The replacement String.
Flags (Optional) A string constant of type VpSearchOptions that determines how to conduct the search. To perform complex searches, you can combine values. The values you can use singly or in combination are:
| vpMatchNoRegExp = 0 | Does not require a match with VrmlPad regular expressions. This is the default. |
| vpMatchWord = 2 | Requires that whole words match. |
| vpMatchCase = 4 | Requires a case-sensitive match. |
| vpMatchRegExp = 8 | Requires a match with VrmlPad regular expressions. |
You can combine values in the Flags parameter by using the Or or concatenation (+) operators. For example, to conduct a case-sensitive forward search, you could specify vpMatchForward Or vpMatchCase or vpMatchForward + vpMatchCase.
The following VBScript example cuts leading zero from all floating-point numbers in the current selection, by using tagged regular expressions.
Selection.ReplaceText "0\.(\d+)", ".\1", vpMatchRegExp
|
|

| |

 |
Select method.
Selects the specified range.
After using this method, the Selection property of the Document object returns a range that is equal to the specified range.
|

| |

 |
SmartFormat method.
Formats text in the specified range according to the current smart formatting settings.
|

| |

 |
Text property, default, read/write, String.
Returns or sets the text in the specified range.
When you set this property, the text of the range is replaced, but the range doesn't expand to include the text; instead, the range is positioned after the inserted contents.
The string can include one or both of the following values:
vbCrLf Represents "\r\n"
vbTab Represents "\t"
|

| |

 |
ToLine property, read/write, Long.
Gets or sets the ending line of the specified range.
If this property is set to a value smaller than the FromLine property, the ToLine property is set to the same value (that is, the FromLine and ToLine property are equal).
If this property is set to -1, the ending line of the range is set to the last line in the file.
|

| |

 |
ToRow property, read/write, Long.
Gets or sets the ending column of the specified range.
If this property is set to a value smaller than the FromRow property, the FromRow property is set to the same value (that is, the FromRow and ToRow property are equal).
If this property is set to -1, the ending column is set to the last column of the ending line of the range.
|

| |

 |
Unindent method, ( [Count] ).
Removes one indent from all lines in the specified range.
This method unindents the contents of the range by the number specified in the Count (by default one). The Unindent method affects all lines whether they are completely or partially within the range.
|

|
|
|