FractalWalk
Technical User
I am using Excel VBA and the FileScriptingObject to open, read and close all text files in a folder. The script works great on my local drive but when I apply it to the network it slows to a crawl. I expected it to be slower, but it is taking over 15 times as long.
Here is the relevant code:
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FolderExists(df & d1) Then
Set fil = Nothing
Set fld = fs.GetFolder(df & d1)
For Each fil In fld.Files
Open fil For Input As #1
Here is the relevant code:
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FolderExists(df & d1) Then
Set fil = Nothing
Set fld = fs.GetFolder(df & d1)
For Each fil In fld.Files
Open fil For Input As #1
Code:
Close
Next fil
End If
On my local drive it takes 18 seconds to find, open and close all the files. On the shared drive it takes 243 seconds. Is that typical or is there anything I can do to speed this process up?