Link to home
Start Free TrialLog in
Avatar of gre
gre

asked on

ActiveX component/reference for FileSystemObject??

I am using the following code:

Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")

I get this error when I run on some systems:
Error 429
'ActiveX component can't create object'

I debugged my program and found that it is thrown by this line:

Set fs = CreateObject("Scripting.FileSystemObject")

So I think I need to add a reference/component for
this object since I am creating it dynamically?
I tried adding the reference:
'Microsoft Scripting Runtime'
but still have problem. Anyone know what activeX reference/
component I need to add to my project????
I have no clue what to add and MSDN sheds no light

thx
Avatar of jrmcg
jrmcg

Have you tried to do it this way...?

Dim fs As New FileSystemObject

and if you have does it produce the same results?

J.R.
You are getting this error because the object "Scripting.FileSystemObject" either doesn't exist (no DLL or EXE provided) or is not registered or registered but the DLL or EXE has a different version.

Try to add the same object to your project's references and create it by

Dim fs As Object
set fs = new Scripting.FileSystemObject


Avatar of gre

ASKER

Haven't tried that, I will, but I don't think it will work.

I think the issue is that it runs fine on my Dev box, but when it is installed
on a different machine, it can't find the activeX object, So I believe it is because
my project doesn't have a reference to the FileSystemObject.

The problem is that I am creating it dynamically, so when I create a DEP file
it only shows activeX dependencies for components I have manually included
into my project, but it cannot know that in my code I create a reference to an
activeX component.

anyway, I'll try your idea, thx
Avatar of gre

ASKER

alex1234,

just saw your comment,

I know I need to add a reference, BUT WHICH ONE????
is  'Microsoft Scripting Runtime' the correct one????
I tried it and it didn't work.

I don't know what reference to check for the call I make
So how do I find out which reference to add for an object I dynamically create???
MSDN talks about the FileSystemObject, but doesn't say which reference to add,
and there is no 'FileSystemObject' in references


On your target machine, check and make sure that the scrrun.dll file exists - if you haven't already.  I would have assumed that it would already be there but it's worth a shot.

J.R.
Avatar of gre

ASKER

scrrun.dll is on the target machine in system32.

How do we know scrrun.dll (which is the reference for Microsoft Scripting Runtime)
is the correct reference?

I think that is the wrong reference for what I am doing.
I think Microsoft Scripting Runtime is for asp scripting???

I need to find out what is the correct reference to add for using

Scripting.FileSystemObject

Obviously once I can figure that out, I think it will solve the problem.
thx
gre,

you said "I think the issue is that it runs fine on my Dev box, but when it is installed
on a different machine, it can't find the activeX object, So I believe it is because
my project doesn't have a reference to the FileSystemObject."

That means that your program runs successfuly on your machine but fails on others. Therefore scrrun.dll either not registered on other machines or has a different CLSID. Unregister scrrun.dll on these PCs and copy the one from yours and register if - this will fix the problem.

Also, you don't have to add a reference to scrrun.dll in your project - that was just a test to see if Scripting.FileSystemObject existed.


 
Add "OLE Automation" to your references
Avatar of gre

ASKER

alex1234
thx for your insight,

I'll try your idea

thx
Avatar of gre

ASKER

already have it checked
Avatar of gre

ASKER

alex1234,

I think you solved the problem.

Although scrrun.dll was on the target box, it had a timestamp of 1997,

the one on my Dev box has a timestamp of 1999.

I tried to unregister the old one, but it gave me an error,
so I just copied over the new one and registered it and it worked!

post an answer so I can give ya tha points.

thx,
Gre
gre, what are the results? Did it work?

ASKER CERTIFIED SOLUTION
Avatar of alex1234
alex1234

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gre

ASKER

alex1234,

did ya see my last comment?

you solution worked,

the scrrun.dll on target machine was old.
I copied new sccrun.dll over and registered it and it WORKED!

thx,
post answer so I can give you the points,

thx again.
Gre