Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 'find' in directory

I'm trying to search for a unique reference number in one
workbook in an archive directory. eg. one cell
containing - "03/405/ful", which could be located in one
of several hundred workbooks of archived files.

i can search the individual workbooks fine, but what
would the best way be to open up each file in the
directory (each with no predictable/regular name) and
search through them individually?

I guess, to summarise, "how would i open every file in a
folder one by one, when I don't know what name they will
have."
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default 'find' in directory

Ron de Bruin has examples of cycling through files in a directory.

http://www.rondebruin.nl/copy3.htm
http://www.rondebruin.nl/copy33.htm


HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

I'm trying to search for a unique reference number in one
workbook in an archive directory. eg. one cell
containing - "03/405/ful", which could be located in one
of several hundred workbooks of archived files.

i can search the individual workbooks fine, but what
would the best way be to open up each file in the
directory (each with no predictable/regular name) and
search through them individually?

I guess, to summarise, "how would i open every file in a
folder one by one, when I don't know what name they will
have."


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default 'find' in directory

Dave,

The follwoing sample code might help you:

Sub All_Speadsheets()
Dim fs, f, f1
fldr = "C:\My Documents\"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(fldr)
Set f1 = f.files
For Each f2 In f1
filenam = fldr & f2.Name
If Right(filenam, 4) = ".xls" Then
Workbooks.Open filenam
'code to do what you want
ActiveWorkbook.Close
End If
Next
End Sub

HTH,
Nikos

-----Original Message-----
I'm trying to search for a unique reference number in one
workbook in an archive directory. eg. one cell
containing - "03/405/ful", which could be located in one
of several hundred workbooks of archived files.

i can search the individual workbooks fine, but what
would the best way be to open up each file in the
directory (each with no predictable/regular name) and
search through them individually?

I guess, to summarise, "how would i open every file in a
folder one by one, when I don't know what name they will
have."
.

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
Directory Jeff Excel Discussion (Misc queries) 1 October 5th 06 04:51 PM
I get message "cannot find directory" with ExcelTools Menu RonDennis2002 Setting up and Configuration of Excel 2 January 4th 06 11:33 PM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM
find files and copy to new directory arne Excel Programming 3 November 26th 03 07:26 PM
Find a directory PK[_5_] Excel Programming 0 September 28th 03 09:52 PM


All times are GMT +1. The time now is 01:38 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"