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

Find a string in an html file

Status
Not open for further replies.

imarg

Technical User
Jun 5, 2006
18
CA
Hi everyone... I am completely stuck on this and cannot find a solution that works anywhere.

I am looking for a way to open a locally saved html file, and get it to look for a particular string and then if it finds that string then do something else with it....

Does anyone know any code that will do this.

Thanks,

Imarg
 
This should find (or not find) it.
Code:
Dim FoundIt As Boolean
With New FileSystemObject
   FoundIt = InStr(.OpenFile("C:\...\myFile.html").ReadAll,"SomeString") > 0
End With
The rest depends on what the "... something else ..." is that you want to do with it.
 
Thanks Golom, this looks like it should work... but when I try to run it, I am told that the FileSystemObject class is not defined... how would I prevent this.


Thanks
 
In the VB/IDE Select "Project / References" and check "Microsoft Scripting Runtime
 
I am doing this using a notepad editor --> as this is actually a vb script. And do not have access to the references... any other way of getting this to work?
 
VBScript questions? - Try forum329

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top