Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to step thru only one subfolder of a folder to find like files
Hi,
i am having trouble with this one. i'll try to explain the best i can. I have a folder named 'homogeneity testing'. there are hundereds of subfolders in that folder, for instance, 400501, 400502, 400503....and so on. But, there are several subfolders in these as well. In each first subfolder, say folder 400501, there is a *lkg_5.xls file i need to extract from. i don't want to go any further than this first subfolder as there are more *lkg_5.xls files in the deeper subfolders. Basically, i want my macro to LookIn C:\homogneity testing\ then look in the next subfolder, '400501' for the *lkg_5.xls file and perform the functions i have set out. then, when done with that file, close and move on to next subfolder, '400502', while skipping the subfolders under '400501'. i think, Maybe, i need a Loop to search only ONE subfolder under 'homogeneity testing' then move on to next dirct subfolder. But........i can't seem to figure out anything that specific. i can only write code to search all subfolders. Anyway, sorry this is so long and still not very informative. Any help will be greatly appreciated. take care Live Long and Prosper! FF |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to step thru only one subfolder of a folder to find like files
FF
How are you looping through all the folders now? If you're using Scripting Runtime, then you can do something like this Dim fso as FileSystemObject Dim PFldr as Folder Dim SFldr as Folder Set fso = New FileSystemObject Set PFldr = fso.GetFolder("C:\homegeneity testing") For Each SFldr in PFldr.SubFolders 'Do stuff Next SFldr This will access the subfolders of PFldr but none of the sub-sub folders. -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "foamfollower" wrote in message om... Hi, i am having trouble with this one. i'll try to explain the best i can. I have a folder named 'homogeneity testing'. there are hundereds of subfolders in that folder, for instance, 400501, 400502, 400503....and so on. But, there are several subfolders in these as well. In each first subfolder, say folder 400501, there is a *lkg_5.xls file i need to extract from. i don't want to go any further than this first subfolder as there are more *lkg_5.xls files in the deeper subfolders. Basically, i want my macro to LookIn C:\homogneity testing\ then look in the next subfolder, '400501' for the *lkg_5.xls file and perform the functions i have set out. then, when done with that file, close and move on to next subfolder, '400502', while skipping the subfolders under '400501'. i think, Maybe, i need a Loop to search only ONE subfolder under 'homogeneity testing' then move on to next dirct subfolder. But........i can't seem to figure out anything that specific. i can only write code to search all subfolders. Anyway, sorry this is so long and still not very informative. Any help will be greatly appreciated. take care Live Long and Prosper! FF |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving a workbook by creating a folder & subfolder | Excel Worksheet Functions | |||
Pulling pdf files from general folder to specific folder | Excel Discussion (Misc queries) | |||
How to find all folder and/or files in a specific location | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) | |||
retreiving number of e-mails from public folder in Outlook, next step | Excel Programming |