I need to list the names of folders horizontally.
Sub 2()
Dim objFSO As Object
Dim objFolder As Object
Dim objSubFolder As Object
Dim i As Integer
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Users\Betty\AppData\Roaming\MetaQuotes\Terminal\B4D9BCD10BE9B5248AFCB2BE2411BA10\MQL4\Files\Export_History")
i = 1
For Each objSubFolder In objFolder.subfolders
Cells(1, i + 1) = objSubFolder.Name
Next objSubFolder
End Sub
Stepping into the code with the debugger, I see that it overwrites each file name in the same cell.