View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
prepotency[_12_] prepotency[_12_] is offline
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