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


I'm trying to loop through all the *.?XT files in the given folder
e.g. xyzcompany.#XT abccomopany.TXT etc..

My code is stuck in some sort of loop that crashes excel. I think i
comes from using the Dir() statement. See what you can glean:


MyFile = Dir(CurDir() & "\*.?XT")

Do While MyFile < ""
Open MyFile For Input As #1

For i = 1 To 3
Line Input #1, txt
Next

... code that parses the file and gets some information ...

Close
MyFile = Dir() 'next file in the directory

Loop



so i can see that it's getting the information because it outputs th
information to my spreasheet but after it gets all the info it goe
into an infinite loop

thoughts?



--
prepotenc
-----------------------------------------------------------------------
prepotency's Profile: http://www.excelforum.com/member.php...fo&userid=2415
View this thread: http://www.excelforum.com/showthread.php?threadid=38683

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


Figured it out. ROFL.

It's because my top part where I loop through 3 times needs a

If Not EOF(1) Then

but all the files in the directory have more than 3 lines in them. s
why is this necessary?

regards,
garret

--
prepotenc
-----------------------------------------------------------------------
prepotency's Profile: http://www.excelforum.com/member.php...fo&userid=2415
View this thread: http://www.excelforum.com/showthread.php?threadid=38683

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
Pulling pdf files from general folder to specific folder [email protected] Excel Discussion (Misc queries) 2 September 8th 09 09:41 PM
Copying all files in a folder to new folder michaelberrier Excel Discussion (Misc queries) 2 June 20th 06 05:35 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
Looping through workbooks in Folder teresa Excel Programming 2 December 29th 04 10:50 AM
Looping thru files Tom Excel Programming 4 January 9th 04 05:05 PM


All times are GMT +1. The time now is 07:15 AM.

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

About Us

"It's about Microsoft Excel"