Previous Document Next Document
Text.Find

Function Find(Text As String, CaseSensitive As Boolean, [StartIndex As Long = 1], [WrapAround As Boolean = False], [IndexingType As cdrTextIndexingType = cdrCharacterIndexing]) As Long

Member of Text

The Find method locates a specified text string in a text stream.

Parameters
Description
Text
Specifies the text to find. The string must be contained within quotation marks.
CaseSensitive
Determines whether to match the case of the text in the Text parameter
StartIndex
Specifies the first text object in a 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.
This parameter is optional, and its default value is 1.
WrapAround
Determines whether the text follows the path of an object’s shape or bounding box
This parameter is optional, and its default value is False.
IndexingType
Specifies the type of text to find. The indexing type can be character, word, or paragraph. The IndexingType parameter has a value of cdrTextIndexingType.
This parameter is optional, and its default value is cdrCharacterIndexing (0).

The following code example creates a paragraph-text block containing the text Wild Rose Cafe. It then looks for the word Rose and inserts the word Red in front of it, resulting in the string Wild Red Rose Cafe.

Sub Test() 
 Dim s As Shape, n As Long 
 Set s = ActiveLayer.CreateParagraphText(0, 0, 2, 1, "Wild Rose 
Cafe") 
 n = s.Text.Find("Rose", False) 
 If n <> 0 Then s.Text.Characters(n, 0) = "Red " 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.