API Documentation > CorelDRAW > 2025-v26 > Text > IVGText
Text.Replace method
Replaces text
Syntax:
Sub Replace(ByVal OldText As String, ByVal NewText As String, ByVal CaseSensitive As Boolean, Optional ByVal StartIndex As Long = 1, Optional ByVal ReplaceAll As Boolean = False, Optional ByVal WrapAround As Boolean = False, Optional ByVal IndexingType As cdrTextIndexingType = cdrCharacterIndexing)
Parameters:
Name Type Description
OldText
String
NewText
String
CaseSensitive
Boolean
StartIndex
Long
Specifies the first text object in the text range. If the index type is set to word and the start index is 3, the StartIndex parameter begins the range at the third word in the selected text frame.
ReplaceAll
Boolean
Specifies whether all instances of old text found in the text range are replaced with new text.
WrapAround
Boolean
Specifies whether the text follows the path of an object's shape or bounding box.
IndexingType
Specifies, through a value of cdrTextIndexingType, the type of text to find. The indexing type can be character, word, or paragraph.
Remarks:
The Replace method replaces one text string with another in a text object.
Examples:
The following VBA example replaces all occurrences of # on the page with the current date.
Sub Test()
Dim s As Shape
For Each s In ActivePage.FindShapes(, cdrTextShape)
  s.Text.Replace "#", CStr(Date), False, ReplaceAll:=True
Next s 
End Sub