I am used to using creat object fucntions to obtain a list of files within a folder:-
Set objFSO = CreateObject("Scripting.FileSystemObject")