Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
File Search
I am using the code below to find text files for importing in to Excel.
I am getting the an error message "Run-Time error '5': Invalid procedure call or argument." The strange part is that I copied this code exactly from another workbook and it work beautifully. Any idea why it would work on one workbook and not another? It bombs out on the file .FileType = msoFileTypeAllFiles. Sheets("Dialog Output").Select Range("g3").Select act = Selection.Value Range("g4").Select mgr = Selection.Value Range("g5").Select stdt = Selection.Value Range("g6").Select enddt = Selection.Value With Application.FileSearch .NewSearch .LookIn = "F:\MAIN\Michael\EXCEL\Trading\Blk Files\" .FileType = msoFileTypeAllFiles .SearchSubFolders = False If .Execute() 0 Then For i = 1 To .FoundFiles.Count If .FoundFiles(i) Like "*" + act + "*.txt" And .FoundFiles(i) Like "*" + mgr + "*.txt" Then If FileDateTime(.FoundFiles(i)) = stdt And FileDateTime(.FoundFiles(i)) <= enddt Then Thanks - Michael |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
file search or search files | Excel Discussion (Misc queries) | |||
Turning a text file name into a search and linking the file as a hyperlink | Excel Discussion (Misc queries) | |||
File Search | Excel Programming | |||
File Search | Excel Programming | |||
Macro to search from one file & place on another file. | Excel Programming |