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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding a particular word in a string in VB 6

Status
Not open for further replies.

vmaruv

Programmer
Apr 8, 2002
102
US
Hi,

How is it possible in VB to know the existance of a particular word in a multi line text.

To be more specific, In my VB code I am capturing the output of a batch file in command line execution into a variable sOutput. I would like to see if the execution has been successful. For this, I need to know if the word successful is found in sOutput.

sOutput has multiple lines like :

C:\Documents and Settings\x_xyz\Desktop>cd c:\
C:\>set ROOT=C:\TCE
C:\>call C:\TCE\data\vars
mode is successful. please proceed.

I wish to search for the word successful and accordingly display message to the user.
how is this possible.

Please help..
Vidya.
 
Code:
If Instr(sOutput, "successful") > 0 then
  Call Msgbox("Operation Successful")
Else
  Call Msgbox("Operation Failed")
End If

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thank You very much. This works !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top