looping through text files in a folder

B

bluewatermist

Hi

I recently had help in reading the next line of a text file but I am now
having problems in looping through and reading and extracting information in
all of the text files in a specific folder.

The previous help was in reading and extracting on a specific file but i
can't seem to get the looping to work.

Can anyone help me please? Below is the title of my previous discussion.
Frederic

Read the next line in a text fil
http://www.microsoft.com/communitie....public.excel.programming&fltr=&wa=wsignin1.0
 
G

goshute

The untested code below should read through all text files in the
specified directory

Dim strFile As String
'Get first file
strFile = Dir("C:\MyFolder\*.txt")

'Begin Processing
Do While Not Trim(strFile) = ""
'Insert file proccessing here . . . . . .
'Get Next File
strFile = Dir()
Loop


Goshute
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top