FindText()

Example 1:

To find the phrase .co.uk in a Text object named Emails starting from the beginning of the text, use the following syntax:

Emails.FindText(".co.uk",0)

Example 2:

To find the number of occurrences of the phrase .co.uk in a Text object named Emails starting from the beginning of the text, use the following syntax:

numOccur = 0;
Counter = 0;
indexPos = 0;
while (numOccur != -1)
{
 numOccur = Emails.FindText(".co.uk",indexPos);
 indexPos = numOccur + 1;
 Counter++;
}
Counter -= 1;

Note:
In the example above, the variable Counter will contain the number of occurrences of the phrase .co.uk. Because the while loop will always run through one extra time, you need to deduct 1 from the end result i.e. the last line of code Counter -= 1.

Close