J
Jarek
Hello,
I'm trying to use Application.FileSearch method to find files in
given directory, using '*' as wildcard. But the macro below stops a
line .FileName="*.xls" (error '5' - invalid parameter)
I've tried to find different types of files, but some extensions i
.FileName allways causes error (*.xls, *.xla, *.rar, *.zip), som
extensions sometimes (*.dbf, *.txt), some extensions are OK (*.doc
*.pps).
What am I doing wrong?
W'2000, XL'97
Sorry for my English.
Many thanks
Jarek
Sub ListFiles()
With Application.FileSearch
.NewSearch
.LookIn = "C:\Data\Excel"
.SearchSubFolders = False
.FileName = "*.xls"
.Execute
End With
cnt = Application.FileSearch.FoundFiles.Count
For i = 1 To cnt
MsgBox Application.FileSearch.FoundFiles.Item(i)
Next i
End Su
I'm trying to use Application.FileSearch method to find files in
given directory, using '*' as wildcard. But the macro below stops a
line .FileName="*.xls" (error '5' - invalid parameter)
I've tried to find different types of files, but some extensions i
.FileName allways causes error (*.xls, *.xla, *.rar, *.zip), som
extensions sometimes (*.dbf, *.txt), some extensions are OK (*.doc
*.pps).
What am I doing wrong?
W'2000, XL'97
Sorry for my English.
Many thanks
Jarek
Sub ListFiles()
With Application.FileSearch
.NewSearch
.LookIn = "C:\Data\Excel"
.SearchSubFolders = False
.FileName = "*.xls"
.Execute
End With
cnt = Application.FileSearch.FoundFiles.Count
For i = 1 To cnt
MsgBox Application.FileSearch.FoundFiles.Item(i)
Next i
End Su