How To get CreateObject("Scripting.FileSystemObject") work properly on computers without VB installed??

Hi!!

I use CreateObject("Scripting.FileSystemObject") commands in many of my programs, but the program can't be installed on computers without VB installed (it can be installed, but the commands containing CreateObject("Scripting.FileSystemObject") doesn't work. I use the SetupWizard, but it doesn't include all the necessary dll's. Can someone tell me which dll's I need to add to my setup program so CreateObject("Scripting.FileSystemObject") work properly on computers without VB installed??

(Visual Basic 6)


/ChristianJ
ChristianJAsked:
Who is Participating?
 
GordonpConnect With a Mentor Commented:
You need scrrun.dll.
The reason setup wizard does not include it automatically is because you using late binding.

Use Early Binding.

ie.

add Microsoft Scripting Runtime to your project references then

Dim oFileSystem as Scripting.FileSystemObject

Set oFileSystem = new Scripting.FileSystemObject


instead of

CreateObject(...)

GordonP
0
 
GordonpCommented:
There are also other advantages to Early Binding.


Syntax Errors are reported at Compile Time.

You get autocomplete etc..

Its Quicker, references to the dll are set at compile time rather than looking it up for each call.

Gordon
0
 
ChristianJAuthor Commented:
Excellent!! Exactly what I needed THANKS!
0
All Courses

From novice to tech pro — start learning today.