Hi I have this code that I am using to list the names of subfolders in an array. However I need it to go one level deeper and get the subfolders of all these folders. What is the best way of doing this? Every method I use goes multiple levals deep and i am left with a list of all folders.
Dim i As Integer
Dim m As Integer
Dim serialnosf() as string
dim NumSF as integer
SerialNoFP = "C:\Users\mmi\Desktop\New folder\test"
Dim fs, f, f1, s, sf
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(SerialNoFP)
Set sf = f.SUBFOLDERS
NumSF = f.SUBFOLDERS.Count
i = 1
ReDim SerialNoSF(1 To NumSF)
For Each f1 In sf
s = f1.Name
SerialNoSF(i) = s
i = i + 1
s = ""
Next
For m = 1 To NumSF
SerialNoUF.SerialNoBox.AddItem SerialNoSF(m)
Next
Dim i As Integer
Dim m As Integer
Dim serialnosf() as string
dim NumSF as integer
SerialNoFP = "C:\Users\mmi\Desktop\New folder\test"
Dim fs, f, f1, s, sf
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(SerialNoFP)
Set sf = f.SUBFOLDERS
NumSF = f.SUBFOLDERS.Count
i = 1
ReDim SerialNoSF(1 To NumSF)
For Each f1 In sf
s = f1.Name
SerialNoSF(i) = s
i = i + 1
s = ""
Next
For m = 1 To NumSF
SerialNoUF.SerialNoBox.AddItem SerialNoSF(m)
Next