?
Solved

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

Posted on 2008-09-29
5
Medium Priority
?
280 Views
Last Modified: 2012-08-13
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.


0
Comment
Question by:utahalee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:Bane83
ID: 22607224
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.
0
 
LVL 10

Expert Comment

by:Bane83
ID: 22607276
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.
0
 

Author Comment

by:utahalee
ID: 22614446
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
0
 
LVL 10

Accepted Solution

by:
Bane83 earned 200 total points
ID: 22625288
Hi there.

Based on the code working for me, but not for yourself, it leads me to believe there is something amiss with your system. A buddy pointed me towards this article, which may be helpful to you!

http://softimage.wiki.avid.com/index.php/ERROR_:_ActiveX_component_can%27t_create_object:_%27Scripting.FileSystemObject%27

Hope that solves it.
0
 

Author Closing Comment

by:utahalee
ID: 31501174
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.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn how to count occurrences of each item in an array.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question