Link to home
Start Free TrialLog in
Avatar of GillyTheTaffy
GillyTheTaffy

asked on

500pnts!! - GetObject In Javascript

I have the following script in an aspx in a client script section.

<html>
<script language="javascript">
var oXlApp;

function getExcelInstance()
{
  try
  { // this never works even if excel is running
    oXlApp=GetObject("","Excel.Application.11")
    alert("Get Object Works!!");
  }
  catch(ex)
  {
    alert("Get Object Failed:- "+ex.message);
    try
    {
      oXlApp=new ActiveXObject("Excel.Application.11");
      alert("ActiveXObject Works!!");
    }
    catch(ex)
    {
      alert("ActiveXObject Failed:- " + ex.message);
            }
  }
}
</script>
<body>
  <input type="button" onclick="getExcelInstance();" value="clickMe" ID="Text1" NAME="Text1"/>
</body>
</html>

The GetObject never works even if there is a running instance which there is after the 1st time hitting the button. I get Automation Server Can't Create Object. The activeXObject then fires and I get an instance of excel for each button click.

I've got a really urgent deadline and this is my last bug!! Surely an easy 500pnts for someone out there!

TIA

This is really urgent as I've got
ASKER CERTIFIED SOLUTION
Avatar of radevo
radevo

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
Avatar of GillyTheTaffy
GillyTheTaffy

ASKER

that is the worst correct answer I have ever had - but thanks for confirming that for me