I have a folder path that I need to iterate through to grab ALL the folders underneath and plot their path
This is what I have so far:
The output that I need is a text file that will show the tree structure for everything within strFolderToSearch
Example:
I don't care about the files - more the tree structure. I'm going to dump this into excel and do some other formatting but don't know how to continuously iterate subfolders without knowing the level of depth.
- Matt
"If I must boast, I will boast of the things that show my weakness
This is what I have so far:
Code:
Option Explicit
Dim strFolderToSearch, objFSO, objRootFolder, objFolder, colSubfolders, strOutput
strFolderToSearch = "C:\Users\mloflin\Desktop\New folder\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objRootFolder = objFSO.GetFolder(strFolderToSearch)
Set colSubfolders = objRootFolder.SubFolders
For Each objFolder in colSubfolders
strOutput = strOutput & objFolder.name
strOutput = strOutput & vbCrLf
Next
MsgBox strOutput
The output that I need is a text file that will show the tree structure for everything within strFolderToSearch
Example:
Code:
..\Folder1..\Folder1\SubFolder1..\Folder1\SubFolder2..\Folder1\SubFolder2\SubSubFolder1\
I don't care about the files - more the tree structure. I'm going to dump this into excel and do some other formatting but don't know how to continuously iterate subfolders without knowing the level of depth.
- Matt
"If I must boast, I will boast of the things that show my weakness