Link to home
Start Free TrialLog in
Avatar of utahalee
utahalee

asked on

How do I fix "Activex component cant' create object" error

the following snippet giives the error "Activex component can't create object".

<SCRIPT LANGUAGE="VBSCRIPT" runat="server">
on error resume next
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
msgbox "fso error - " & err.description

All I am trying to do is read a text file on the server and format the text data in a table on a web page.
I am coming from windows apps and script background and don't know why this script won't work in a html file.


Avatar of Bane83
Bane83
Flag of Canada image

Hi there,

Just testing your little snippet, I get a parser error on the like runat="server" for your script.

This, however, worked:

[code]<script language="vbscript" type="text/vbscript">
on error resume next
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
msgbox "fso error - " & err.description
</script><script language="vbscript" type="text/vbscript">
on error resume next
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
msgbox "fso error - " & err.description
</script>[/code]

Hope that solves it for you.
Ok well the above script is supposed to only read:

<script language="vbscript" type="text/vbscript">
on error resume next
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
msgbox "fso error - " & err.description
</script>

Sorry about that.
Avatar of utahalee
utahalee

ASKER

I added your change but I still get the same error.  
Someone told me to change CreateObject to Server.CreateObject.  I now did the error "Object Required".
The script in a .vbs file by itself works on the server but I get  theerrors when I add the script to an html file on the same server.

I get the same error "Activex component can't create object" in Javascript  script with the line:
var fso = new ActiveXObject("Scripting.FileSystemObject")

Any other suggestions why I can't use the FileSystemObject in script?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Bane83
Bane83
Flag of Canada image

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
Thanks for your help.  I was afraid the problem was going to be something in the system.  I guess we'll start looking that direction.