View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Roy Harrill Roy Harrill is offline
external usenet poster
 
Posts: 14
Default Capturing Unknown Subfolder Name

Hi All,

I'm trying to find a way to capture a string containing the pathname of a
folder's subfolder.

For example, assume the root directory has two subfolders, named
"mynewstuff" and "myoldstuff", but you (the programmer) don't know these
names ahead of time. What code would produce a string array containing (at
element 0) "c:\mynewstuff\" and (at element 1) "c:\myoldstuff"? My goal is
to create an array containing the pathnames of all the folders on the
computer (and network if present). This s/b fairly easy using a recursive
looping routine, starting with the root directory and drilling down getting
the name of each folder's immediate subfolder(s).

I thought about trying to use ChDir to somehow get to the subfolder and then
using CurDir to get the full path, but I can't use ChDir without a specific
subfolder path, which of course is what I'm seeking.

Application.FileSearch.SearchScopes possibly could help, but I can't
determine whether it would or not.

I know the Subfolders property of File System Objects in Windows Script is
just what I need, but I must avoid using FSO due to security concerns.

I would appreciate any help with VBA or Office (Excel) code that would
generate an unknown subfolder path string.

TIA.

Roy