Directory Tree Builder

This will create a tree-like hierarchical list of all the subfolders and files from the selected directory
copy all 3 sections into one module

Option Explicit
Dim Position As Long
Dim Indent As Long
Dim FileCount As Double
Dim FolderCount As Double
Dim BoldStatus As Boolean
Sub ListDirectoryTree()
Cells.Clear
ActiveSheet.UsedRange.Select
Dim StartFolder As String
FileCount = 0
FolderCount = 0
Position = 0
Indent = 0
Dim flDlg As FileDialog
Set flDlg = Application.FileDialog(msoFileDialogFolderPicker)
flDlg.InitialFileName = Application.DefaultFilePath & "\"
If flDlg.Show = False Then MsgBox "Cancel was clicked. Operation aborted.", vbOKOnly + vbExclamation: Exit Sub
StartFolder = flDlg.SelectedItems(1)
If Right(StartFolder, 1) <> "\" Then StartFolder = StartFolder & "\"
Dim AskForBold As Variant
AskForBold = MsgBox("Do you want to bold the folder names?", vbYesNo, "Bold Folder Names")
Select Case AskForBold
Case vbYes
BoldStatus = True
Case vbNo
BoldStatus = False
End Select
Range("A1").Value = StartFolder
If BoldStatus Then Range("A1").Font.Bold = True
Call Recursive_ListDirectoryTree(StartFolder, BoldStatus)
MsgBox "Done!" & vbNewLine & vbNewLine & "Found " & FileCount & " files and " & FolderCount & " folders"
Application.StatusBar = ""
End Sub
Sub Recursive_ListDirectoryTree(strFolder As String, BoldFolder As Boolean)
Dim objFSO As Object, objFile As Object, objSubFolder As Object
Dim objFiles As Object, objSubFolders As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSubFolder = objFSO.GetFolder(strFolder)
Set objFiles = objSubFolder.Files
Set objSubFolders = objSubFolder.Subfolders
Indent = Indent + 1
On Error Resume Next
For Each objFile In objFiles
Range("A2").Offset(Position, Indent) = objFile
Position = Position + 1
FileCount = FileCount + 1
Application.StatusBar = "[ Files: " & FileCount & " ] [ Folders: " & FolderCount & " ]"
Next objFile
For Each objSubFolder In objSubFolders
If BoldFolder Then
Range("A2").Offset(Position, Indent) = objSubFolder
Range("A2").Offset(Position, Indent).Font.Bold = True
Else
Range("A2").Offset(Position, Indent) = objSubFolder
End If
Position = Position + 1
FolderCount = FolderCount + 1
Application.StatusBar = "[ Files: " & FileCount & " ] [ Folders: " & FolderCount & " ]"
Call Recursive_ListDirectoryTree(objSubFolder.Path, BoldStatus)
Next objSubFolder
DoEvents
Indent = Indent - 1
On Error GoTo 0
End Sub