Hi Ehsan,
You can use VBScript from inside VBA to read the file names. I've included a sample script below that you can add to a new module in VBA.
The Debug.Print will print the names of the files in the Immediate Window, so you'll likely want to change this part to have it do something more meaningful, like add the file names to a variable to make comparing them to your tables easier.
-
Sub ReadFiles()
-
-
Dim fso, root, file, files, path
-
-
'you may have to use the complete path if you're
-
'trying to access a folder on a server instead of
-
'just referencing a drive letter.
-
-
path = "Your path here"
-
-
Set fso = CreateObject("Scripting.FileSystemObject")
-
-
Set root = fso.GetFolder(path)
-
-
Set files = root.files
-
-
For Each file In files
-
Debug.Print file.Name
-
Next
-
-
End Sub
-
If you have multiple folders with files in it that you need to check, you can add a recursive step to the code I provided by setting the root equal to the subfolder and looping through each with an additional call to the ReadFiles subroutine.
Hope this helps and good luck,
beacon