Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Open Excel files in a folder

Perhaps the FileSearch object. This is basically the code in the help file
for the filesearch object. With Application.FileSearch .NewSearch
.LookIn = "C:\My Documents"
.SearchSubFolders = False
.FileName = ".xls"
' .MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
' MsgBox .FoundFiles(i) set wkbk =
workbooks.Open(.foundfiles(i)) ' work on the workbook
wkbk.close Savechanges:=False ' or true
Next i
Else
MsgBox "There were no files found."
End If
End With-- Regards,Tom Ogilvy"John Acocella" wrote
in message ...
I want to retrieve the file names of excel files in a
specific directory, retrieveing them one at a time through
a looping routine. Is there any way to do this in Excel
besides using the DIR function? I thought I read
something in the Microsoft knowledge base, but I can't
find it. Thanks.



Reply
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
How do you set Excel 2007 to open files in a specific folder? Opening to a specific folder Excel Discussion (Misc queries) 2 August 12th 07 02:58 AM
can't open excel files from common folder dsdproduction Excel Discussion (Misc queries) 4 July 5th 07 08:34 PM
Can't Open Certain Excel Files in Folder Charles A C Excel Discussion (Misc queries) 2 March 23rd 07 12:02 AM
Open Excel files in a folder Bob Phillips[_5_] Excel Programming 0 August 20th 03 04:47 PM
open all files in a folder and ... walt Excel Programming 5 August 7th 03 02:23 AM


All times are GMT +1. The time now is 10:26 PM.

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"