Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you can use VBA you already have full access to the filesystem, so what's
the problem with using FSO ? In this context its use has no impact on security. Tim -- Tim Williams Palo Alto, CA "Roy Harrill" wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tim,
I'm not a security guru, but my understanding is that under some enterprise IT policies, WSH/FSO may be disabled on user's PCs due to the ease by which it can be used to spread viruses. So if I were planning on others using my program, some of them couldn't do so if I required WSH/FSO. Roy "Tim Williams" <timjwilliams at gmail dot com wrote in message ... If you can use VBA you already have full access to the filesystem, so what's the problem with using FSO ? In this context its use has no impact on security. Tim -- Tim Williams Palo Alto, CA "Roy Harrill" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel links to subfolder | Excel Discussion (Misc queries) | |||
Importing from a subfolder in your Inbox into excel | Excel Discussion (Misc queries) | |||
Copy excel file to subfolder | Excel Programming | |||
subfolder Loop? But, only one.... | Excel Programming | |||
how to step thru only one subfolder of a folder to find like files | Excel Programming |