Category Archives: FileSystemObject

How To Use VBA To Loop Through The Files In A Folder

So, picture this…you have a client who just has the files in a folder illustrated by a picture, like a jpg.

You need the file names from the picture, but you can use an OCR (Object Character Resolution) to list the files on the image because a lot of the text shows up like garbage.

So the next bright idea you come up with is to list the files in the folder, by sending the user a VBA file with a button they can click on, select the folder, loop through the files in the folder, and print the files on a worksheet in the workbook.

Then the user can save the workbook and send it back to you.

How about that

Here’s the code to do such a thing:

Let me know if you have questions.