LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Searching for files below current directory

Perhaps I misunderstood: Is TaskState the name of your range? (I presumed it
was a property you were referring to)

If so, you could open the workbook as shown above and then
TaskStates(i) = NewWB.Names("TaskState").Value
NewWB.Close

To avoid flicker either set screen updating off or do this in a separate,
invisible Excel session.

Or you could use either DDE or an ADO query to get the value - but those you
would need to research
--
- K Dales


"George" wrote:

K Dales,

Thanks for the reply. "ThisWorkbook.Path" was great, I can't believe I
didn't check something like that.

Now that I can loop around the current directory can I get the named range
from the current file (.FoundFiles(i)) from within the macro?

I'm presuming I can do something like the following:

taskStates(i) = .FoundFiles(i)!TaskState

???

Thanks


"K Dales" wrote:

As for the 2nd question: It is not really easier (you use either
Range(Address) or Range(Name)) but in some ways better to use the named
range. If you have to change the structure of the workbook at any time the
cell address may change but the name will remain the same, so you would have
an easier time maintaining the code if you use named ranges.
--
- K Dales


"George" wrote:

Hi there,

I want to search for files in (and below) the directory that the current
document is in. Then I need to pull out a couple of bits of information from
each file and bring those values in onto one sheet in the current Excel
document.

I need to know what to set ".LookIn" to so that it searches from the current
directory. I know to set .SearchSubFolders to true and I know how to loop
around the files that it finds. My problem is setting the .LookIn property
correctly.

Is it going to be easier to pull the information from each file is the cells
are named? That shouldn't be a problem as I have control over the files.

Thanks
George

 
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
Searching Excel Directory Mickey Excel Discussion (Misc queries) 1 August 14th 08 09:55 PM
current directory Ross[_2_] Excel Discussion (Misc queries) 1 April 2nd 07 10:00 PM
Current Directory Mallasch Excel Discussion (Misc queries) 4 September 15th 06 03:05 AM
changing current directory to that of the current open file unnameable Excel Programming 2 May 19th 04 11:14 AM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 04:49 PM.

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

About Us

"It's about Microsoft Excel"