Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Listing files with full path

Is there any function which acts like Dir but returns the full path of the
file and not just its filename? I want to find files of a type in several
directories, load the names in an array then go through them all and process
them. It would help if the file names in the array contained the path
information so that the part of the macro which does the processing can go
straight to the file without having to worry about which folder it's in.

Grateful for advice.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Listing files with full path

Don't you already know the directory/folder at the time you call Dir? So just
concatenate this with the file name returned, e.g.

Const SEARCH_FOLDER as String = "C:\MyFolder\"
Dim sFiles(100) as String, s as String
Dim l as Long

s=Dir(SEARCH_FOLDER & "*.*")
Do While s""
sFiles(l) = SEARCH_FOLDER & s
l=l+1
s=Dir
Loop

....or am I missing something?

Cheers,
Dave

"simonc" wrote:

Is there any function which acts like Dir but returns the full path of the
file and not just its filename? I want to find files of a type in several
directories, load the names in an array then go through them all and process
them. It would help if the file names in the array contained the path
information so that the part of the macro which does the processing can go
straight to the file without having to worry about which folder it's in.

Grateful for advice.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Listing files with full path

Thank you. So simple I didn't think of it...

"Dave Ramage" wrote:

Don't you already know the directory/folder at the time you call Dir? So just
concatenate this with the file name returned, e.g.

Const SEARCH_FOLDER as String = "C:\MyFolder\"
Dim sFiles(100) as String, s as String
Dim l as Long

s=Dir(SEARCH_FOLDER & "*.*")
Do While s""
sFiles(l) = SEARCH_FOLDER & s
l=l+1
s=Dir
Loop

...or am I missing something?

Cheers,
Dave

"simonc" wrote:

Is there any function which acts like Dir but returns the full path of the
file and not just its filename? I want to find files of a type in several
directories, load the names in an array then go through them all and process
them. It would help if the file names in the array contained the path
information so that the part of the macro which does the processing can go
straight to the file without having to worry about which folder it's in.

Grateful for advice.

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
File path listing and analysis DaveyC Excel Discussion (Misc queries) 3 December 20th 07 01:36 PM
Full path possible to be seen? Octavio New Users to Excel 10 July 2nd 06 08:51 PM
Show full path of files being saved JERRY Excel Discussion (Misc queries) 4 May 16th 06 07:57 PM
Full path in title bar ntoze Excel Discussion (Misc queries) 0 February 21st 06 07:26 PM
Full path in taskbar GregR Excel Programming 8 August 9th 05 03:34 AM


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