I use this code to get all files in a folder/subfolder, but the problem is if my folder has spaces in its name then it does not work. e.g in this code, c:\a\*.dgpx will work but c:\a a\*.dgpx will not work.
Code:
Sub GeneratingFilespathfromfolderandsubfolderssnb()
c00 = "[B]c:\a\*.dgpx[/B]"
sn = Application.Transpose(Split(CreateObject("wscript.shell").exec("cmd /c Dir " & c00 & " /b /s").stdout.readall, vbCrLf))
Cells(1).Resize(UBound(sn)) = sn
End Sub