Subject: Creating Active X Components
Posted By: mahulda Post Date: 5/11/2004 6:43:11 AM
Here a few lines of Code I obtained from this site
http://www.greggriffiths.org/webdev/both/excel/activex.html
<script language='VBScript'>
    Dim Xcl

    Sub StartExcel()
        Xcl = CreateObject("Excel.Application")
        Xcl.Visible = true
        dim newBook = Xcl.Workbooks.Add
     end sub
</script>
<body onload="StartExcel()">
</body>

When i run this program I get the following error
System.Exception: Cannot create ActiveX component.

Is there anything wrong with the code ?
If not then How do I enable Active X Components in my Internet Explorer

Reply By: serup Reply Date: 5/12/2004 12:51:37 PM
Here is a small example of how to use ActiveX components in IE.
I hope it can help you with your problem.

Sincerely,
Johnny

<HTML>
<HEAD>
<TITLE>ATL 7.0 test page for ActiveX object </TITLE>
</HEAD>
<BODY>


'******************************
'One way of doing it :
'******************************
<OBJECT ID="<name of your ActiveX object>" CLASSID="CLSID:E158200F-877C-456C-A561-061F38E93A74" VIEWASTEXT></OBJECT>
<script language="VBScript">
    <name of your ActiveX object>.About()     ' calling a member function inside your ActiveX
</Script>


'******************************
'Another way of doing it :
'******************************
<script language="jscript">
var ActiveXobjectProgId = "name.name.version";

function ActiveXAbout()
{
    var result = true;
    try
    {
        var tp = new ActiveXObject("name.name.version");
    }
    catch(e)
    {
        ActiveXobjectProgId = "name.name";
        tp = new ActiveXObject(ActiveXobjectProgId );
    }

    tp.About();
    return result;
}

ActiveXAbout();
</Script>

</BODY>
</HTML>

Reply By: Greg Griffiths Reply Date: 1/14/2006 9:00:39 AM
This is due to the security model on the client machine, check out the links at http://www.greggriffiths.org/webdev/both/excel/conclusion.html for info on resolving this issue.

Go to topic 38719

Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392
Return to index page 391
Return to index page 390
Return to index page 389
Return to index page 388
Return to index page 387
Return to index page 386