小弟用asp向excel中导入数据时出现automation不能创建对象,恳求大家帮助!
我的测试代码如下:
<%Response.ContentType="application/vnd.ms-excel"%>
<form action="" method="post" name="form1" target="_self">
<table id="MainTable">
<tr>
<td><B>早班</B></td>
<td><B>中班</B></td>
</tr>
</table>
</form>
<SCRIPT LANGUAGE="javascript">
<!--
function AutomateExcel()
{
// Start Excel and get Application object.
var oXL = new ActiveXObject("Excel.Application");
// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var table = document.all.MainTable;
var hang = table.rows.length;
var lie = table.rows(0).cells.length;
// Add table headers going cell by cell.
for (i=0;i<hang;i++)
{
for (j=0;j<lie;j++)
{
oSheet.Cells(i+1,j+1).value = table.rows(i).cells(j).innerText;
}
}
oXL.Visible = true;
oXL.UserControl = true;
}
//-->
</SCRIPT>
<input type="BUTTON" name="out_excel" onClick="AutomateExcel();" value="导出到excel" class="notPrint">
</body>
错误是:automation不能创建对象
小弟用过regsvr32 scrrun.dll无效,修改ie安全为最低也无效,求求大家帮助一下?本机安装了excel。