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!