I would like to loop through the files of a directory using vba in Excel 2010.
In the loop, I will need:
Dir
function loses focus easily when I handle and process files from other folders.
I've gotten better results with the component FileSystemObject
.
Full example is given here:
http://www.xl-central.com/list-files-fso.html
Don't forget to set a reference in the Visual Basic Editor to Microsoft Scripting Runtime (by using Tools > References)
Give it a try!