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.Fi leSystemOb ject")
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.
<SCRIPT LANGUAGE="VBSCRIPT" runat="server">
on error resume next
dim fso
set fso = CreateObject("Scripting.Fi
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.
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.Fi leSystemOb ject")
msgbox "fso error - " & err.description
</script>
Sorry about that.
<script language="vbscript" type="text/vbscript">
on error resume next
dim fso
set fso = CreateObject("Scripting.Fi
msgbox "fso error - " & err.description
</script>
Sorry about that.
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.F ileSystemO bject")
Any other suggestions why I can't use the FileSystemObject in script?
Thanks
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.F
Any other suggestions why I can't use the FileSystemObject in script?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.Fi
msgbox "fso error - " & err.description
</script><script language="vbscript" type="text/vbscript">
on error resume next
dim fso
set fso = CreateObject("Scripting.Fi
msgbox "fso error - " & err.description
</script>[/code]
Hope that solves it for you.