Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
fth fth is offline
external usenet poster
 
Posts: 7
Default list of folders and subfolder.; quit simple ..but.;

hi to all,

I'm looking for somethings looks like simple but..
i want to create a list of all subfolder of a certain folder.
No need to list file or others stuff..just get a list of folder and sub.

could you please help me?

many thanks in advance,

Frederic
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default list of folders and subfolder.; quit simple ..but.;

http://groups.google.com/group/micro...4f306f5853b33#
--
Gary''s Student - gsnu200803


"fth" wrote:

hi to all,

I'm looking for somethings looks like simple but..
i want to create a list of all subfolder of a certain folder.
No need to list file or others stuff..just get a list of folder and sub.

could you please help me?

many thanks in advance,

Frederic

  #3   Report Post  
Posted to microsoft.public.excel.programming
fth fth is offline
external usenet poster
 
Posts: 7
Default list of folders and subfolder.; quit simple ..but.;

Hi Gary,

I get your code and try it but i don't have the expected result..

I have orror message like:

wrong number of arguments..

a idea?

best regards and many thanks for your help,

Frederic

"Gary''s Student" wrote:

http://groups.google.com/group/micro...4f306f5853b33#
--
Gary''s Student - gsnu200803


"fth" wrote:

hi to all,

I'm looking for somethings looks like simple but..
i want to create a list of all subfolder of a certain folder.
No need to list file or others stuff..just get a list of folder and sub.

could you please help me?

many thanks in advance,

Frederic

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default list of folders and subfolder.; quit simple ..but.;

Sub MakeFolderList()
Call ListSubFoldersInFolder("C:\Program Files")
End Sub
'---
Function ListSubFoldersInFolder(ByRef strPath As String)
'Jim Cone - Portland, Oregon USA - September 2008
Dim oFSO As Object
Dim oFolder As Object
Dim oSubFldr As Object
Dim N As Long
Application.ScreenUpdating = False
N = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(strPath)
Cells(N, 1).Value = oFolder.Path
N = N + 1

For Each oSubFldr In oFolder.Subfolders
Cells(N, 1).Value = oSubFldr.Name
N = N + 1
Call ListSubFolders(oSubFldr, N)
Next

Application.ScreenUpdating = True
Set oFSO = Nothing
Set oFolder = Nothing
End Function
'---
Function ListSubFolders(ByRef oParentFolder As Object, ByRef lngR As Long)
Dim oSubFolder As Object
For Each oSubFolder In oParentFolder.Subfolders
Cells(lngR, 2).Value = oSubFolder.Name
lngR = lngR + 1
ListSubFolders oSubFolder, lngR
Next 'oSubFolder
End Function
'---
Jim Cone
Portland, Oregon USA



"fth"
wrote in message
hi to all,
I'm looking for somethings looks like simple but..
i want to create a list of all subfolder of a certain folder.
No need to list file or others stuff..just get a list of folder and sub.

could you please help me?
many thanks in advance,
Frederic
  #5   Report Post  
Posted to microsoft.public.excel.programming
fth fth is offline
external usenet poster
 
Posts: 7
Default list of folders and subfolder.; quit simple ..but.;

Jim,

Many thanks, it was exactely what I'm looking for.
I just have to modifysome tips (cell in one column, full path ..)

I make a test with a very very big tree and let you know the result.

This code is the first step on what I have to do.

The next step is to read all the security parameters for each folder (user
or groups - for each, what is the security..)

If you have a idea..

many thanks to you (and to the others who gave me some good tracks)

Frederic

"Jim Cone" wrote:

Sub MakeFolderList()
Call ListSubFoldersInFolder("C:\Program Files")
End Sub
'---
Function ListSubFoldersInFolder(ByRef strPath As String)
'Jim Cone - Portland, Oregon USA - September 2008
Dim oFSO As Object
Dim oFolder As Object
Dim oSubFldr As Object
Dim N As Long
Application.ScreenUpdating = False
N = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(strPath)
Cells(N, 1).Value = oFolder.Path
N = N + 1

For Each oSubFldr In oFolder.Subfolders
Cells(N, 1).Value = oSubFldr.Name
N = N + 1
Call ListSubFolders(oSubFldr, N)
Next

Application.ScreenUpdating = True
Set oFSO = Nothing
Set oFolder = Nothing
End Function
'---
Function ListSubFolders(ByRef oParentFolder As Object, ByRef lngR As Long)
Dim oSubFolder As Object
For Each oSubFolder In oParentFolder.Subfolders
Cells(lngR, 2).Value = oSubFolder.Name
lngR = lngR + 1
ListSubFolders oSubFolder, lngR
Next 'oSubFolder
End Function
'---
Jim Cone
Portland, Oregon USA



"fth"
wrote in message
hi to all,
I'm looking for somethings looks like simple but..
i want to create a list of all subfolder of a certain folder.
No need to list file or others stuff..just get a list of folder and sub.

could you please help me?
many thanks in advance,
Frederic



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
List folders but not sub folders kaiser Excel Programming 2 July 19th 07 11:14 AM
List of Folders marianne Excel Programming 10 June 7th 06 11:48 AM
check if in list else quit application Pierre via OfficeKB.com[_2_] Excel Programming 3 November 7th 05 07:28 PM
vba advice how 2get a input box to quit by entering the word quit+ 4 a msgbox to disp RELWOD85[_4_] Excel Programming 3 August 1st 05 07:11 PM
Get folders list Eugene[_5_] Excel Programming 1 December 10th 03 10:44 AM


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