Use activeX in HTML

Posted on 2001-07-08
Last Modified: 2008-03-04
Hi guys.

I'm trying to use the OBJECT tag in my HTML, but the object does not created.
When I'm trying to create it using the 'createObejct' statement (of VBScript), it works fine.
When I look at the "CodeDownloadErrorLog" file, I see the problem is: "Class not registered (80040154)"
I know for sure the class IS registered (I can instantiate it using vbscript).

What is the problem?

Question by:memilavi
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
LVL 22

Expert Comment

ID: 6262299
There is one difference though. The object tag is supposed to show something on the screen (like a usercontrol), something you can interact with and has a graphical user interface. Using CreateObject or it's equivalent new ActiveXObject you can create an object in memory, but that object does NOT have a GUI. It only contains additional classes and functions you can use.

With other words, I'm not surprised.


Author Comment

ID: 6262313
Well, in this case, how can I capture events from an object created by CreateObject?
LVL 22

Accepted Solution

CJ_S earned 100 total points
ID: 6262382
Normally in VB (and in VBscript in IE 6) you can use the

Dim WithEvents x as New OBJECTNAME

but that is not supported in VBScript. I'm sorry, but there is no way. The only way you can get it to work is by creating a usercontrol in Visual Basic, and adding the component to it by setting a reference. Then you create Events in the usercontrol (ActiveX control project btw) and fire them whenever necessary:

Public Event MyEvent()

RaiseEvent MyEvent()

Next thing is using the Package & Deployment wizard to create a cabinet file (.cab), and that program will create an html-page with the correct object tag included.

Then it will work, but only for Internet Explorer users who have activex turned on (same applies for the CreateObject though).

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.


Expert Comment

ID: 6262987
To create an Automation object in JavaScript, assign the new ActiveXObject to an object variable, f.e.:

var ExcelSheet;
ExcelSheet = new ActiveXObject("Excel.Sheet");


Author Comment

ID: 6263012
hakob, maybe you didn't understand my question.

I asked how to capture events from an automation object, not how to create it.

Perhaps you are new here, but next time don't lock a question. If your comment is actually the answer, it will be accepted as such.

CJ, I am currently checking your suggestion. I will come up with results ASAP.
LVL 22

Expert Comment

ID: 6263107
Let me know. After tomorrow I won't be on for a week (or so)...


Expert Comment

ID: 6263169
actually, an object doesn't neccessarily need to have a GUI of its own. I have created few objects that doesn't have a GUI but exposes its IDispatch interface so that I can use it for automation.

as for as events go the standard method of handling events given an object like "window" you do the following

<script language="vbscript">

sub window_onload
 MsgBox "hello world"
end sub


refer to this document for more,
LVL 22

Expert Comment

ID: 6264223
you do need a GUI for objects within the object-tag. I might be very well wrong, but I never could use the object-tag with plain components exposing the IDispatch and IUnknown interfaces (without a GUI).



Author Comment

ID: 6264711
Thanks, CJ_S, that was exactly what I needed to know.
I have another question regarding objects in HTML, and I hope you can help me with this too.

Look in the questions list for that.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Calculating percentage 2 49
Slush on text 2 29
Check if field exists SPUtility 5 48
Global version website variable for clearing cache 10 33
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

752 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