Thread: File name
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter[_20_] Peter[_20_] is offline
external usenet poster
 
Posts: 20
Default File name

Sub ListFiles()
Dim I As Integer
Cells.Delete
With Application.FileSearch
.LookIn = CurDir
.Filename = "*.xls"
If .Execute 0 Then
For I = 1 To .FoundFiles.Count
Cells(I, 1) = .FoundFiles(I)
Next I
Else
MsgBox "There were no files found."
End If
End With
Range("a1").Select
End Sub

Peter

marijan glavac wrote in message
...
Hi,
I need to get filename of all *.xls files in specific directory and put it
on the active worksheet.
I don't know where to start .
Plese help.
Thanks in advance,

Marijan