Previous Document Next Document
TextRange.Replace

Function Replace(Text As String, [LanguageID As cdrTextLanguage = cdrLanguageNone], [CharSet As cdrTextCharSet = cdrCharSetMixed], [Font As String]) As TextRange

Member of TextRange

The Replace method replaces the text range with the text string and returns the new range.

Parameters
Description
Text
Specifies the text to insert
LanguageID
Specifies the language code
This parameter is optional, and its default value is cdrLanguageNone (0).
CharSet
Specifies the character set
This parameter is optional, and its default value is cdrCharSetMixed (-1).
Font
Specifies the font
This parameter is optional.

The following code example replaces the first word with new text:

Sub Test() 
 Dim d As Document 
 Dim s As Shape 
 Dim t As Text 
 Set d = CreateDocument 
 Set s = d.ActiveLayer.CreateParagraphText(3, 3, 5, 5, _ 
  "This is an example.") 
 Set t = s.Text 
 t.Story.Words.First.Replace "This will replace the first word " & _ 
  "with this text " 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.