Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mike,
Try this, Example from VBA Help & modified. Sub Test() Dim filearray() Dim a as long Dim MyPath, MyName MyPath = "C:\windows\temp\" ' 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 'Debug.Print MyName ' Display entry only if it represents a directory. a = a + 1 ReDim Preserve filearray(a) filearray(a) = MyName End If End If MyName = Dir ' Get next entry. Loop Open "c:\filearray.txt" For Output As #1 For j = 1 To a Write #1, filearray(j) Next j Close #1 End Sub Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/ (Excel Add-ins) *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
creating directories | Excel Discussion (Misc queries) | |||
sub directories again | Excel Programming | |||
sub directories | Excel Programming | |||
Directories | Excel Programming | |||
Searching directories... | Excel Programming |