LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
file search or search files Richad Excel Discussion (Misc queries) 0 October 22nd 09 07:56 PM
Turning a text file name into a search and linking the file as a hyperlink AlistairM Excel Discussion (Misc queries) 1 January 26th 06 04:55 AM
File Search MD Excel Programming 2 August 19th 04 09:28 PM
File Search unplugs[_48_] Excel Programming 1 August 8th 04 02:12 PM
Macro to search from one file & place on another file. Luong[_2_] Excel Programming 0 May 6th 04 04:53 PM


All times are GMT +1. The time now is 07:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"