J
jjresti
Hi!
I'd like to scan a directory and report all files present in it in a
list box.
I use this code (found on this wonderful site) but if I launch this
macro excel goes in crash.
Could you help me, please?
With Application.FileSearch
..NewSearch
..LookIn = "c:\data\h3g"
..Filename = "*.*"
..SearchSubFolders = IncludeSubFolder
..FileType = msoFileTypeAllFiles
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) = 0 Then Exit Sub
For FileCount = 1 To .FoundFiles.Count
lb_Dash.AddItem (.FoundFiles(FileCount))
Next FileCount
..FileType = msoFileTypeExcelWorkbooks ' reset filetypes
End With
I'd like to scan a directory and report all files present in it in a
list box.
I use this code (found on this wonderful site) but if I launch this
macro excel goes in crash.
Could you help me, please?
With Application.FileSearch
..NewSearch
..LookIn = "c:\data\h3g"
..Filename = "*.*"
..SearchSubFolders = IncludeSubFolder
..FileType = msoFileTypeAllFiles
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) = 0 Then Exit Sub
For FileCount = 1 To .FoundFiles.Count
lb_Dash.AddItem (.FoundFiles(FileCount))
Next FileCount
..FileType = msoFileTypeExcelWorkbooks ' reset filetypes
End With