From: Esradekan on
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
From: H�ctor Miguel on
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.


From: Esradekan on
On Mar 30, 8:12 pm, "H ctor Miguel" <NOhemiordiS...(a)PLShotmail.com>
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
From: minyeh on
On Mar 30, 3:39 pm, Esradekan <esrade...(a)gmail.com> wrote:
> On Mar 30, 8:12 pm, "H ctor Miguel" <NOhemiordiS...(a)PLShotmail.com>
> 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
From: Esradekan on
On Mar 30, 9:06 pm, minyeh <myj...(a)gmail.com> wrote:
> On Mar 30, 3:39 pm, Esradekan <esrade...(a)gmail.com> wrote:
>
>
>
>
>
> > On Mar 30, 8:12 pm, "H ctor Miguel" <NOhemiordiS...(a)PLShotmail.com>
> > 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.