I have a process that searches all of the files within a particular folder
and based on the name of the file, updates a status within a MS Access
database and then moves the file to a subfolder within that folder.
My original code used the Application.FileSearch technique, but in testing I
got all kinds of results that just were not logical based on my code.
Sometimes it worked great, sometimes it did not. So I just started to look
around for another approach to do this. I looked into using the DIR function
but I need to know how many files are in the folder before I begin processing
and I was unable to determine that using the DIR function. So I decided to
use the FileSystemObject.
I know that it is slower than other techniques that I found, but it seemed
to be the most straight forward, and I don't believe that I will be
processing large volumes of data so performance is not a major issue.
--
Karen Duplantis
Douglas J. Steele said:
Look for Microsoft Scripting Runtime (which should be
C:\Windows\System32\scrrun.dll), and then declare the variable as
Dim objFSO As Scripting.FileSystemObject
What are you trying to do, though, that you think you need FSO? I've found
extremely few cases where it's actually necessary. And in those few cases, I
never both with setting the reference, but use Late Binding instead.
That means you'd use
Dim objFSO As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")