关于asp导出excel的问题!
<!--#include file="../conn/HR_Conn.asp"-->
<%
'Set xlApp = Server.CreateObject("EXCEL.APPLICATION")
Set xlApp = CreateObject("EXCEL.APPLICATION")
xlApp.Visible = true
'response.Write(xlApp.Visible)
set rs=Server.CreateObject("ADODB.Recordset")
strSQL="select * from Salary"
rs.open strSQL,conn,3,3
'dim xl
Set xlBook = xlApp.Workbooks.Add
Set xlSheet1 = xlBook.Worksheets(1)
xlSheet1.cells(1,1).value ="职工工资一览表 "
xlSheet1.range("A1:W1").Font.Bold=true
xlSheet1.range("A1:W1").Font.Size=20
xlSheet1.range("A1:W1").merge
xlSheet1.cells(2,1).value = "姓名"
xlSheet1.cells(2,2).value = "性别"
xlSheet1.cells(2,3).value = "职工编号"
xlSheet1.cells(2,4).value = "一月"
xlSheet1.cells(2,5).value = "二月"
xlSheet1.cells(2,6).value = "三月"
xlSheet1.cells(2,7).value = "四月"
xlSheet1.cells(2,8).value = "五月"
xlSheet1.cells(2,9).value = "六月"
xlSheet1.cells(2,10).value = "七月"
xlSheet1.cells(2,11).value = "八月"
xlSheet1.cells(2,12).value = "九月"
xlSheet1.cells(2,13).value = "十月"
xlSheet1.cells(2,14).value = "十一月"
xlSheet1.cells(2,15).value = "十二月"
xlSheet1.cells(2,16).value = "其他"
xlSheet1.cells(2,17).value = "当年公基金"
xlSheet1.cells(2,17).ColumnWidth=10
xlSheet1.cells(2,18).value = "全部工资"
xlSheet1.cells(2,19).value = "发工资月数"
xlSheet1.cells(2,19).ColumnWidth=10
xlSheet1.cells(2,20).value = "平均工资"
xlSheet1.cells(2,21).value = "单位"
xlSheet1.cells(2,21).ColumnWidth=12
xlSheet1.cells(2,22).value = "职工类别"
xlSheet1.cells(2,23).value = "备注"
cnt = 3
do while not rs.eof
xlSheet1.cells(cnt,1).value = rs("Name")
xlSheet1.cells(cnt,2).value = rs("Sex")
xlSheet1.cells(cnt,3).value = rs("EmpId")
xlSheet1.cells(cnt,4).value = rs("Jan")
xlSheet1.cells(cnt,5).value = rs("Feb")
xlSheet1.cells(cnt,6).value = rs("Mar")
xlSheet1.cells(cnt,7).value = rs("Apr")
xlSheet1.cells(cnt,8).value = rs("May")
xlSheet1.cells(cnt,9).value = rs("Jun")
xlSheet1.cells(cnt,10).value = rs("Jul")
xlSheet1.cells(cnt,11).value = rs("Aug")
xlSheet1.cells(cnt,12).value = rs("Sep")
xlSheet1.cells(cnt,13).value = rs("Oct")
xlSheet1.cells(cnt,14).value = rs("Nov")
xlSheet1.cells(cnt,15).value = rs("Dece")
xlSheet1.cells(cnt,16).value = rs("Others")
xlSheet1.cells(cnt,17).value = rs("Accumu")
xlSheet1.cells(cnt,18).value = rs("FullPay")
xlSheet1.cells(cnt,19).value = rs("FactMonths")
xlSheet1.cells(cnt,20).value = rs("AvgPay")
xlSheet1.cells(cnt,21).value = rs("Department")
xlSheet1.cells(cnt,22).value = rs("EmpClass")
xlSheet1.cells(cnt,23).value = rs("Remark")
rs.movenext
cnt = cint(cnt) + 1
loop
xlSheet1.Application.Visible = true
'response.Write(xlSheet1.Application.Visible)
set xlApp=nothing
xlApp.close
set rs=nothing
rs.close
%>
不知道为什么,已经把xlApp.Visible = true,但是输出的时候总是False,请高手帮忙!
觉得总是连接的问题!