@Evaluate using LS

Hi

I have a problem with using evaluate in LS. The text below is in a text file(fileForSMS.txt) on my local hard drive.

I would like to extract the phone number(represented by lots of X)

Name: John Doe

Phone number: XXXXXXXXXXX Cellphone:YYYYYYYYYYYY

Adress:Blablabal

Here is the code in my agent. Somehow, the Text variable is not set by the Evaluate statement. The linein Variant is populated.

Dim filenum As Integer, filename As String, linein As String, Text As String

filename = "c:\fileForSMS.txt"

filenum% = Freefile()

Open filename For Input As filenum 

Do Until Eof(filenum)

	

	Line Input #filenum, linein

	Dim tmpTekst As Variant

	

	tmpText = Evaluate({@middle(linein;"phone number: ";11)})

	Text = tmpTekst(0)

	

	

Loop 

Any ideas?

Henrik

Subject: @Evaluate using LS

You can not do it on this way as “linein” is interpreted as variable inside formula context and it is always blank.Do it as :

tmpText=Left(StrRight(linein,“Phone number:”),11)

Spell “Phone number” in exact case as it appears in the file

Subject: RE: @Evaluate using LS

Works perfectly!

Thanks!

H

Subject: @Evaluate using LS

check the name of your variable.

it dosen’t always have the same name.

Dave