PDA

View Full Version : List of files in a folder and sub folder



krishhi
02-16-2010, 04:57 AM
Hi,

How to create list of files in a folder/sub folder. I just want the file names only. I don't need any file attributes.

I found a article in kb but it doesn't help me. I am using excel 2007.

Thanks in advance,

krrish

Bob Phillips
02-16-2010, 05:11 AM
Explain in what way it doesn't help.

krishhi
02-16-2010, 06:57 AM
Sorry xld,

I got the right link here:


http://www.vbaexpress.com/kb/getarticle.php?kb_id=1042
by the way can any one explain this steps.


If .SelectedItems.Count <> 0 Then
xDirect$ = .SelectedItems(1) & "\"
xFname$ = Dir(xDirect$, 7)
Do While xFname$ <> ""
ActiveCell.Offset(xRow) = xFname$
xRow = xRow + 1
xFname$ = Dir

Bob Phillips
02-16-2010, 07:48 AM
It takes the first of the folder names selected and loops through processing every file in that older.

krishhi
02-16-2010, 09:24 AM
It takes the first of the folder names selected and loops through processing every file in that older.

hey sorry to bugging you,


Dir(xDirect$, 7)

In this code, what is mean by 7?