Am I missing a reference object? Trying to retrieve a list of files in a directory and have them show in a sheet.
Also, would it be possible to get the directory location from a specific cell in the file?
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("C:\VBA Folder")
For Each oFile In oFolder.Files
Cells(i + 1, 1) = oFile.Name
i = i + 1
Next oFile
End Sub
Here:
Set oFSO = CreateObject("Scripting.FileSystemObject")
Runtime error 429 on a Windows machine.