View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Greg Glynn Greg Glynn is offline
external usenet poster
 
Posts: 137
Default Retrieve data from external excel document

You might use the FileSearch Method. It will find ALL files that
match the criteria, which should be OK if there is just one.

With Application.FileSearch
'Standard FileSearch Stuff
.NewSearch
.LookIn = "c:\my folder"
.Filename = "*src data.XLS"
.SearchSubFolders = False
.Execute

For i = 1 To .FoundFiles.Count
'Find the name of the workbook without the directory info
WbFileName = Mid(.FoundFiles(i), InStrRev(.FoundFiles(i), "\") + 1,
200)
workbooks.Open .FoundFiles(i)

'Do your processing here ...

'then close the workbook
Workbooks(WbFileName).Close

Next i
End with