API Documentation > CorelDRAW > 2025-v26 > TextRange > IVGTextRange
TextRange.SetRange method
Sets the starting and ending position of the text range
Syntax:
Sub SetRange(ByVal Start As Long, ByVal End As Long)
Parameters:
Name Type Description
Start
Long
End
Long
Remarks:
The SetRange method sets the starting and ending positions of a text range.
Examples:
The following VBA example underlines the text range that includes the third-to-tenth characters.
Sub Test()
Dim s As Shape
Dim tr As TextRange
Dim d As Document
Set d = CreateDocument
Set s = d.ActiveLayer.CreateParagraphText(2, 2, 4, 4, _
  "This is an example")
Set tr = s.Text.Story
tr.SetRange 3, 10
tr.Underline = cdrDoubleThinFontLine 
End Sub