I created VBA code recently for Excel 2003 in which I use the code:
Set fs2 = Application.FileSearch
fs2.LookIn = CheckFolder
fs2.Filename = "*.*;*"
fs2.SearchSubFolders = True
fs2.Execute
to create a list of files. I then loop through the FoundFiles, opening them one by one and extracting various pieces of information. The code worked great. I was then asked to create additional functionality that required creating a second list of files for which I created an fs3 object with code similar to the above. When the fs3.Execute line is run, files from the fs3 file list replace files in the fs2 file list, which obviously screws up my program. The two lists of files are being drawn from different folders, on the same drive. Is there some reason that a second Application.Filesearch cannot be executed from within a loop that is cycling through a list of files from the first Application.Filesearch?
Thanks,
Paul Hudgens
Set fs2 = Application.FileSearch
fs2.LookIn = CheckFolder
fs2.Filename = "*.*;*"
fs2.SearchSubFolders = True
fs2.Execute
to create a list of files. I then loop through the FoundFiles, opening them one by one and extracting various pieces of information. The code worked great. I was then asked to create additional functionality that required creating a second list of files for which I created an fs3 object with code similar to the above. When the fs3.Execute line is run, files from the fs3 file list replace files in the fs2 file list, which obviously screws up my program. The two lists of files are being drawn from different folders, on the same drive. Is there some reason that a second Application.Filesearch cannot be executed from within a loop that is cycling through a list of files from the first Application.Filesearch?
Thanks,
Paul Hudgens