#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 86
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 434
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 86
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 30
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 86
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 434
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listing Folder Contents into a Column LyndieBee Excel Worksheet Functions 1 August 29th 07 03:16 PM
Listing the contents of a folder [email protected] Excel Discussion (Misc queries) 2 April 12th 07 03:54 AM
Followup: Folder listing [email protected] Excel Discussion (Misc queries) 1 February 23rd 07 02:23 AM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
Periodically listing files in a folder haven104 Excel Discussion (Misc queries) 2 January 10th 06 09:01 AM


All times are GMT +1. The time now is 01:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"