text: how can i get a list of files from a directory in vba? i need some piece of vba code to list all files from a folder. you will need to make a reference to the scripting runtime by going to tools --> references  then add a listbox and a command button and in the command button insert this code :  dim fso dim folder  set fso = createobject("scripting.filesystemobject") set folder = fso.getfolder("c:&#92;path")  for each file in folder.files listbox1.additem file.name next  if you need more help please post back or email me as this doesnt seem to work wtih code very well.  take a look here on how to create a reference to the file system object in vba / vbscript :  http://computerperformance.co.uk/logon/vbscript/vbscript_windows_fso.htm  as you can see yahoo answers doesnt allow posting of code very well and has commented out my createobject("scripting.filesystemobject")