![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Mar 2004
Posts: 7
|
Hi,
I am new at VBA and I have this problem. I want to load a bunch of files by filename (e_us1.dat to e_us11.dat). I am using the code below but the filenames come in the wrong order: e_us1, e_us10, e_us11, e_us2, e_us3...e_us9. Any ideas on how to sort them ? Thanks. With Application.FileSearch .LookIn = "C:\" .Filename = "e_us*" If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then MsgBox "There are " & .FoundFiles.Count & _ " file(s) found." For i = 1 To .FoundFiles.Count MsgBox .FoundFiles(i) Next i Else MsgBox "There were no files found." Exit Sub End If End With Benedicte |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|