Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to go through a series of folders without using "folder"?
I want to go through all the subfolders of a certain folder and compare
a variable in the folder names. I looked here for a way to do this, but the code I found used "folder" (object, property, method?) which I don't have in XL2000. Is there a way around this? Or is there an add-in that will add that object/property/method? Thanks for your help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to go through a series of folders without using "folder"?
In VBA, go to the Tools menu, choose References, and put a check
next to "Windows Scripting Runtime". Then you can use code like the following: Sub AAA() Dim F As Scripting.File Dim FF As Scripting.Folder Dim FSO As Scripting.FileSystemObject Set FSO = New Scripting.FileSystemObject Set FF = FSO.GetFolder("H:\Test") For Each F In FF.Files Debug.Print F.Name Next F End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "davegb" wrote in message ups.com... I want to go through all the subfolders of a certain folder and compare a variable in the folder names. I looked here for a way to do this, but the code I found used "folder" (object, property, method?) which I don't have in XL2000. Is there a way around this? Or is there an add-in that will add that object/property/method? Thanks for your help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to go through a series of folders without using "folder"?
Debug.Print F.Name
If you want the complete filename, including the folder(s), use Debug.Print F.Path -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chip Pearson" wrote in message ... In VBA, go to the Tools menu, choose References, and put a check next to "Windows Scripting Runtime". Then you can use code like the following: Sub AAA() Dim F As Scripting.File Dim FF As Scripting.Folder Dim FSO As Scripting.FileSystemObject Set FSO = New Scripting.FileSystemObject Set FF = FSO.GetFolder("H:\Test") For Each F In FF.Files Debug.Print F.Name Next F End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "davegb" wrote in message ups.com... I want to go through all the subfolders of a certain folder and compare a variable in the folder names. I looked here for a way to do this, but the code I found used "folder" (object, property, method?) which I don't have in XL2000. Is there a way around this? Or is there an add-in that will add that object/property/method? Thanks for your help. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to go through a series of folders without using "folder"?
Chip Pearson wrote: Debug.Print F.Name If you want the complete filename, including the folder(s), use Debug.Print F.Path -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chip Pearson" wrote in message ... In VBA, go to the Tools menu, choose References, and put a check next to "Windows Scripting Runtime". Then you can use code like the following: Sub AAA() Dim F As Scripting.File Dim FF As Scripting.Folder Dim FSO As Scripting.FileSystemObject Set FSO = New Scripting.FileSystemObject Set FF = FSO.GetFolder("H:\Test") For Each F In FF.Files Debug.Print F.Name Next F End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com Chip, thanks for you help. "References" is not availble in the menu, grayed out. Any suggestions? "davegb" wrote in message ups.com... I want to go through all the subfolders of a certain folder and compare a variable in the folder names. I looked here for a way to do this, but the code I found used "folder" (object, property, method?) which I don't have in XL2000. Is there a way around this? Or is there an add-in that will add that object/property/method? Thanks for your help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I turn off "Initializing Folders" every time I open a file. | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
"Search for files and folders" option doesnot work for 100% | Excel Discussion (Misc queries) | |||
"Folder Select" Dialogue - Opening multiple files from selected folder | Excel Programming | |||
Backup to specific folder if workbook names begins with "NSR" or "MAC" | Excel Programming |