FileSystemObject


G

Guest

I am unable to find this object in my online help so that I can understand
better how to use it. When i try and delclare a variable as FileSystemObject
the type does not appear. When I looked in the Reference Library, I was
unable to find it so that I could add it. Can anyone tell me how to get this
object's help file so that I can figure out how to use it?
 
Ad

Advertisements

D

Douglas J. Steele

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")
 
Ad

Advertisements

G

Guest

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")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

FileSystemObject 2
FileSystemObject 2
FileSystemObject 5
FileSystemObject 1
FileSystemObject No LongName 1
FileSystemObject drive error 4
FileSystemObject Remane file 7
Question re FileSystemObject 2

Top