File interigation

Dan_T

Registered User.
Local time
Today, 20:03
Joined
Jul 14, 2004
Messages
116
I'm stuck without the help files for a week and I have a little project and I can't remember the syntax or quite how I did it last time.

I have in a folder some text files that I want to iterate through and interigate the contents. Essentially can someone point me to the syntax to expose the files and loop through them.

eg I have 1000 text files in folder C:/useless/git/ has/crap/memory and I want to start at the top open first .txt file and find a string in it. If found perform a function. Then move to the next .txt file and so on.

Many many thanks for helping one who is short of memory and a dimwit for misplacing the office installation disks used on this machine.
 
From the Help file...

The following code illustrates the use of the OpenTextFile method to open a file for appending text:

Sub OpenTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending,TristateFalse)
f.Write "Hello world!"
f.Close
End Sub

HTH :o
 
Thanks for the reply thats really useful. Also what I am looking for is to open the first file and interogate the text close it, then open the second file. I wont be selecting a file by name.
 

Users who are viewing this thread

Back
Top Bottom