这是原码,运行之后出错.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>直接访问Excel</title>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
-->
</style></head>
<body>
<form action="" method="post" name="form1">
<table width="400" height="276" border="0" align="center" background="add_manager.gif">
<tr>
<td width="123" height="83"> </td>
<td width="267" height="83"> </td>
</tr>
<tr>
<td height="42" align="right">请填写显示的列数:</td>
<td width="267" height="42"><input type="text" name="cln"></td>
</tr>
<tr>
<td align="right">Excel路径:</td>
<td><input name="asf" type="file" id="asf"></td>
</tr>
<tr>
<td> </td>
<td><input type="button" name="Submit" value="查看" onClick="sd()"></td>
</tr>
</table>
</form>
<script language="vbscript">
sub sd()
set xlap=CreateObject("Excel.Application")
strsource=document.all.form1.asf.value
cln=document.all.form1.cln.value
set xlbook=xlap.Workbooks.open(strsource)
set xlsheet=xlbook.worksheets(1)
i=1
document.Write("<table border='0' align='center' cellspacing='1' bgcolor='#000000' width='400'>")
while xlsheet.cells(i,1)<>""
document.Write("<tr bgcolor='#FFFFFF'>")
for j=1 to cln
document.Write("<td>"&xlsheet.cells(i,j)&"</td>")
next
document.Write("</tr>")
i=i+1
wend
document.Write("</table>")
set xlsheet=nothing
set xlbook=nothing
xlap.quit
end sub
</script>
</body>
</html>
出错的是:
Activex 部件不能创建对象: 'Excel.Application'
路上的各为朋友.这个问题怎么解决,万分感谢!