ProjectExplorer
Programmer
I need to get the names of all subfolder names in a main folder. I have set reference to run time scripting and using the FileScripting object but cannot work out the code. I believe its along the lines of:
Public Function Get SubFileName()
Dim MainFolder As Folders
Dim F As Folder
Dim Fsys As New Scripting.FileSystemObject
Set MainFolder = Fsys.GetFolder("C:\Temp\")
For Each F In MainFolder
Debug.Print F.Name
Next F
End Function
....but doesn't work. Any ideas please.
Public Function Get SubFileName()
Dim MainFolder As Folders
Dim F As Folder
Dim Fsys As New Scripting.FileSystemObject
Set MainFolder = Fsys.GetFolder("C:\Temp\")
For Each F In MainFolder
Debug.Print F.Name
Next F
End Function
....but doesn't work. Any ideas please.