TheWennerWoman
Active Member
- Joined
- Aug 1, 2019
- Messages
- 303
- Office Version
- 365
- Platform
- Windows
Hello,
I have a cell where the user uses a folder picker to select where they want files saved to. Once the files are saved I want to list them. The cell the user is entering the path in is called "Choose_path".
I tried the below and it errors on the line shown. What do I need to put in there?
Thanks for reading.
I have a cell where the user uses a folder picker to select where they want files saved to. Once the files are saved I want to list them. The cell the user is entering the path in is called "Choose_path".
I tried the below and it errors on the line shown. What do I need to put in there?
Code:
Sub LoopThroughFiles()
Dim oFSO As Object
Dim oFolder As Object
Dim oFile As Object
Dim i As Integer
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(Choose_path.Value) '<---- doesn't like this
For Each oFile In oFolder.Files
Sheet3.Cells(i + 1, 1) = oFile.Name
i = i + 1
Next oFile
End Sub
Thanks for reading.