Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default looping through text files in a folder

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 file
http://www.microsoft.com/communities...a= wsignin1.0


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default looping through text files in a folder

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default looping through text files in a folder


thank you for the quick reply. It works perfectly

Frederic.

"goshute" wrote:

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
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
automating import of several text files from specified folder DnD Excel Programming 2 December 29th 07 12:38 PM
Open all Text files in a folder systemx[_8_] Excel Programming 4 March 31st 06 02:22 AM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
Searching through the contents of a Folder of text files jase[_2_] Excel Programming 1 January 6th 06 03:48 PM
Looping through files in a folder prepotency[_12_] Excel Programming 1 July 13th 05 04:23 PM


All times are GMT +1. The time now is 02:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"