nice n easy..
first click project -> references, and check Microsoft Scripting Runtime
Win 98 SE and before will need a newer version of scrrun.dll
VB Code:
Public Function GetFolders(sStartFolder As String) As String
On Error Resume Next
Dim fso As New FileSystemObject
Dim f As Folder
Dim fldr As Folder
Set fldr = fso.GetFolder(sStartFolder)
GetFolders = fldr.Path & vbCrLf
If fldr.SubFolders.Count > 0 Then
For Each f In fldr.SubFolders
GetFolders = GetFolders & GetFolders(f.Path)
Next
End If
If Err.Number = 92 Then GetFolders = vbNullString
'windows did not allow the program to look inside this folder, so ignore it completely (ie c:\system volume information in win2000)
End Function
note - the code got an edit recently... the following posts may or may not make sense