Here’s a trick to get a quick list of files from a certain directory.
Open the Excel or Access Visual Basic Editor and then press Ctrl+G to see the Immediate Window.
Enter the following syntax and then press Enter. Be sure to change the directory (in red) to the path of your directory.
File = Dir(“C:\MyDirectory\“): Do Until File = “”: Debug.Print File: File = DIR(): Loop
Your reward will be a list of all the files in that directory. You can now copy this list and use it as you see fit.
I’ll be honest. There is no real reason to do this in the Immediate Window. After all, you can write a permanent macro to list all the files in a directory.
But if you need a quick one-off list of files, this is a nifty way to get it.