Printing List of Names of Excel Files in My Briefcase


Posted by Sam Gordon on February 04, 2002 8:53 AM

How do I print a list of the names of Excel Files files in My Briefcase ?
Thanks,

Sam Gordon



Posted by Ivan F Moala on February 04, 2002 11:35 PM

Try


Sub Test()
Dim F
Dim x As Double
x = 1

F = Dir("C:\WINDOWS\Desktop\My Briefcase\*.xls")

Columns("A:A").Clear
Do While Len(F) > 0
Cells(x, 1) = F
x = x + 1
F = Dir()
Loop

'Sort & Format cell range
With Range(Cells(1, 1), Cells(1, 1).End(xlDown))
.Columns.AutoFit
.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End With
End Sub

Ivan