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!

Read Entire File to find a line

Status
Not open for further replies.

ToeJamNEarl

Programmer
Jan 26, 2004
91
US
Hi Guys,

I want to do the following.

Open up a file using a FileSystemObject and look through the file and check to see if a specific string either ADD or CHG is in the file. If they are set a flag to true, otherwhise set the flag to false.

Thanks,

-Diran
 
Use the search box at the top of this page for instr, filesystemobject, boolean function to name a couple. These will show you exactly how to do it.

BB
 
Diran Have u worked this out if not i can post u how to do it let me know.. cheers mate
 
Camy123,

I have worked this out, thank you. But as always,

feel free to paste some code? It may help others out if they do a keyword search having a similar question as I did.

Thanks all.


-Diran
 
Dim fso as new filesystemobject
dim ts as textstream
dim myTextString as string
dim found as string

set ts = fso.opentextfile("c:myfile.txt",forreading)

mytextstring = ts.readall

found = cbool(instr(1,mytextstring,stringtofind))

set ts=nothing
set fso = nothing

BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top