API Documentation > CorelDRAW > 2025-v26 > Page > IVGPage
Page.TextReplace method
Finds and replaces a string of text on the page
Syntax:
Sub TextReplace(ByVal OldText As String, ByVal NewText As String, ByVal CaseSensitive As Boolean, Optional ByVal ReplaceSelectedOnly As Boolean = True)
Parameters:
Name Type Description
OldText
String
NewText
String
CaseSensitive
Boolean
ReplaceSelectedOnly
Boolean
Specifies whether only the selected text is to be replaced with the TextReplace method.
Remarks:
The Replace method finds and replaces a specified text string.
Examples:
The following VBA example creates three text objects and replaces the word Some with Short (resulting in one of the text objects becoming Short Sentence).
Sub Test()
ActiveLayer.CreateArtisticText 0, 0, "Text1"
ActiveLayer.CreateArtisticText 0, 3, "Some Sentence."
ActiveLayer.CreateArtisticText 0, 5, "Word"
ActivePage.TextReplace "Some", "Short", True, False 
End Sub