Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Tom, that will do perfectly - I don't need the array.
Darren On Sun, 6 Mar 2005 15:25:45 -0500, Tom Ogilvy wrote: If you don't need the intermediate array, the example from HELP on DIR shows the way. Here it is modified: Sub ListSubs() Dim MyPath As String, MyName As String Dim rw As Long rw = 1 MyPath = "c:\MyRoot\" ' Set the path. MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry. Do While MyName < "" ' Start the loop. ' Ignore the current directory and the encompassing directory. If MyName < "." And MyName < ".." Then ' Use bitwise comparison to make sure MyName is a directory. If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then Cells(rw, 1).Value = MyName ' Display entry only if it rw = rw + 1 ' represents a directory. End If End If MyName = Dir ' Get next entry. Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Please help to list folders and subfolders tree in Excel or Word | Excel Discussion (Misc queries) | |||
Auto look through subfolders | Charts and Charting in Excel | |||
Creating folders and subfolders from excel file list | Excel Discussion (Misc queries) | |||
Modify - look at files within subfolders | Excel Programming | |||
Create subfolders in a folder | Excel Programming |