Hello,
How can you code something that allows the user to:
Choose a specific folder, by using Windows file browser
Get the folder's path
Get all the folders on that original folder
List all the file names on the active workbook.
I have so far:
How can you code something that allows the user to:
Choose a specific folder, by using Windows file browser
Get the folder's path
Get all the folders on that original folder
List all the file names on the active workbook.
I have so far:
Code:
Sub allfiles()Dim objFSO As Object
Dim objFolder As Object
Dim objSubFolder As Object
Dim i As Integer
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder("THE CHOSEN FOLDER PATH")
i = 1
'loops through each file in the directory and prints their names and path
For Each objSubFolder In objFolder.subfolders
'print folder name
Cells(i + 1, 1) = objSubFolder.Name
'print folder path
Cells(i + 1, 2) = objSubFolder.Path
i = i + 1
Next objSubFolder
End Sub