Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Folder listing
I want to get a folder listing (from a specific folder) that shows sub
folders in the next column (under the parent folder). How do I do that does anyone know? TIA (*-*)< Esra |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Folder listing
hi, Esra !
I want to get a folder listing (from a specific folder) that shows sub folders in the next column (under the parent folder)... does a vba-macro serves well ? Sub List_Subfolders() Dim StartPath As String, FName As String, n As Integer StartPath = Range("a1").Text If Right(StartPath, 1) < "\" Then StartPath = StartPath & "\" FName = Dir(StartPath & "*", vbDirectory) Do While FName < "" If (GetAttr(StartPath & FName) And vbDirectory) = vbDirectory Then _ If FName < "." And FName < ".." Then _ Range("b1").Offset(n) = FName: n = n + 1 FName = Dir() Loop End Sub hth, hector. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Folder listing
On Mar 30, 8:12*pm, "H ctor Miguel"
wrote: hi, Esra ! I want to get a folder listing (from a specific folder) that shows sub folders in the next column (under the parent folder)... does a vba-macro serves well ? Sub List_Subfolders() * Dim StartPath As String, FName As String, n As Integer * StartPath = Range("a1").Text * If Right(StartPath, 1) < "\" Then StartPath = StartPath & "\" * FName = Dir(StartPath & "*", vbDirectory) * Do While FName < "" * * If (GetAttr(StartPath & FName) And vbDirectory) = vbDirectory Then _ * * * If FName < "." And FName < ".." Then _ * * * * Range("b1").Offset(n) = FName: n = n + 1 * * FName = Dir() * Loop End Sub hth, hector. Hi Hector, Thanks for the reply, but I'm not sure how to use this (adapt it for my purposes). Where do I change this so I can insert the folder name that will be my 'parent' folder? Am I having a blonde moment? Esra TIA |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Folder listing
On Mar 30, 3:39*pm, Esradekan wrote:
On Mar 30, 8:12*pm, "H ctor Miguel" wrote: hi, Esra ! I want to get a folder listing (from a specific folder) that shows sub folders in the next column (under the parent folder)... does a vba-macro serves well ? Sub List_Subfolders() * Dim StartPath As String, FName As String, n As Integer * StartPath = Range("a1").Text * If Right(StartPath, 1) < "\" Then StartPath = StartPath & "\" * FName = Dir(StartPath & "*", vbDirectory) * Do While FName < "" * * If (GetAttr(StartPath & FName) And vbDirectory) = vbDirectory Then _ * * * If FName < "." And FName < ".." Then _ * * * * Range("b1").Offset(n) = FName: n = n + 1 * * FName = Dir() * Loop End Sub hth, hector. Hi Hector, Thanks for the reply, but I'm not sure how to use this (adapt it for my purposes). *Where do I change this so I can insert the folder name that will be my 'parent' folder? Am I having a blonde moment? Esra TIA- Hide quoted text - - Show quoted text - To answer Esra question, 1. press [Alt]+[F11] to open the VB Editor. 2. Choose Insert -- Module and copy the code above given by Hector and paste it into the module. 3. Close the VB Editor. 4. in cell A1, key in ur directory for your parent folder i.e. D: \Parent\ 5. run the macro (you could apply a short-cut key or put a button or shape such as the text box from the drawing toolbar on the sheet and attach the macro to it), and the folder listing will appear in column B To Hector, Have a similar question, how can i get a file listing from a specific folder including its subfolders? for example, my parent folder is "Customer List" under that Folder, i have several sub folders named like "A-F", "G-L", "M-R", "S-Z", and under each folders is the sales reports [.xls] or [.xlsx] for each customers, named by their customer ID and the date of last modified. can i get a master listing of these files (excluding the folders) including the filetype? (either in one column or two column is fine) Thanks a lot, i've been trying this for a while and it makes me headache. Min Yeh |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Folder listing
On Mar 30, 9:06*pm, minyeh wrote:
On Mar 30, 3:39*pm, Esradekan wrote: On Mar 30, 8:12*pm, "H ctor Miguel" wrote: hi, Esra ! I want to get a folder listing (from a specific folder) that shows sub folders in the next column (under the parent folder)... does a vba-macro serves well ? Sub List_Subfolders() * Dim StartPath As String, FName As String, n As Integer * StartPath = Range("a1").Text * If Right(StartPath, 1) < "\" Then StartPath = StartPath & "\" * FName = Dir(StartPath & "*", vbDirectory) * Do While FName < "" * * If (GetAttr(StartPath & FName) And vbDirectory) = vbDirectory Then _ * * * If FName < "." And FName < ".." Then _ * * * * Range("b1").Offset(n) = FName: n = n + 1 * * FName = Dir() * Loop End Sub hth, hector. Hi Hector, Thanks for the reply, but I'm not sure how to use this (adapt it for my purposes). *Where do I change this so I can insert the folder name that will be my 'parent' folder? Am I having a blonde moment? Esra TIA- Hide quoted text - - Show quoted text - To answer Esra question, 1. press [Alt]+[F11] to open the VB Editor. 2. Choose Insert -- Module and copy the code above given by Hector and paste it into the module. 3. Close the VB Editor. 4. in cell A1, key in ur directory for your parent folder i.e. D: \Parent\ 5. run the macro (you could apply a short-cut key or put a button or shape such as the text box from the drawing toolbar on the sheet and attach the macro to it), and the folder listing will appear in column B To Hector, Have a similar question, how can i get a file listing from a specific folder including its subfolders? for example, my parent folder is "Customer List" under that Folder, i have several sub folders named like "A-F", "G-L", "M-R", "S-Z", and under each folders is the sales reports [.xls] or [.xlsx] for each customers, named by their customer ID and the date of last modified. can i get a master listing of these files (excluding the folders) including the filetype? (either in one column or two column is fine) Thanks a lot, i've been trying this for a while and it makes me headache. Min Yeh- Hide quoted text - - Show quoted text - Isnt part of that what I was wanting? Thank you Hector, I appreciate your efforts. I just found an add-in at Chip Pearsons website (www.cpearson.com I think from memory) and works a treat to do just what you want here. Check it out. Esra. |
#6
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Folder listing
hi, minyeh !
Have a similar question, how can i get a file listing from a specific folder including its subfolders? for example, my parent folder is "Customer List" under that Folder, i have several sub folders named like "A-F", "G-L", "M-R", "S-Z", and under each folders is the sales reports [.xls] or [.xlsx] for each customers, named by their customer ID and the date of last modified. can i get a master listing of these files (excluding the folders) including the filetype? (either in one column or two column is fine) ... as Esra comments, Chip Pearson as in his web-site articles related to this listing folders-files (i.e.) http://www.cpearson.com/excel/FolderTree.aspx and downloadable examples as: http://www.cpearson.com/Zips/DirTreeXLS.zip http://www.cpearson.com/Zips/DirTreeSetup;.zip hth, hector. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Listing Folder Contents into a Column | Excel Worksheet Functions | |||
Listing the contents of a folder | Excel Discussion (Misc queries) | |||
Followup: Folder listing | 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) | |||
Periodically listing files in a folder | Excel Discussion (Misc queries) |