Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

An Instr problem 2

Status
Not open for further replies.

JamesBBB

Technical User
Nov 2, 2005
74
GB
Hi All,

Could someone please tell me what is wrong with this statement, I cant see what Im doing wrong and its driving me loco.

Basically I have a string called ba which is being tested in a loop

when the string has "(s)" and "bytes" in it then code should be executed.

so when the string is:-

ba = " 644files(s) 1615377566772 bytes"

it goes through a test as follows:

If InStr(1, ba, "(s)") And InStr(1, ba, "bytes") Then
execute some code
end if

The trouble is, the above line is not finding the requested (s) and bytes.

Any ideas, many thanks

James
 
If InStr(1, ba, "(s)")>0 And InStr(1, ba, "bytes")>0 ...

combo
 
Thanks for the response guys, much appreciated.

Combo, I tried your solution and its now perfect

Many many thanks, you made my weekend

Cheers

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top