Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
For loop for each file in a folder?
Tom Ogilvy Wrote: sFile = dir("C:\Myfolder\*.txt") do while sFile < "" bk =Workbooks.Open("C:\MyFolder\" & sFile) . . . bk.Close SaveChanges:=false sFile = Dir() Loop Since I'm a beginner at VBA (but not new to programming), I'd like to try to understand the logic in this code... The first 2 lines say, do this as long as the directory of C:\Myfolder\*.txt is not empty, right? Then I'm not sure what the rest means. How does it cycle through each file in a directory? Thanks, Kieran -- Kieran1028 ------------------------------------------------------------------------ Kieran1028's Profile: http://www.excelforum.com/member.php...o&userid=15678 View this thread: http://www.excelforum.com/showthread...hreadid=277010 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Loop through folder of workbooks and add rows | Excel Worksheet Functions | |||
For loop for each file in a folder? | Excel Programming | |||
Loop thru All Files in a Folder | Excel Programming | |||
Loop through all files in a folder | Excel Programming | |||
Loop through workbooks in a folder and return the value of cell M43 | Excel Programming |