在工程中引用Microsoft Excel类型库
因为office 版本的不同,在代码写完之后,去掉引用 Microsoft Excel 9.0 Object Library(EXCEL2000
调用 excel 对象之前先创建
比如:
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
这样就可以避免因为版本的不同,出现问题了
---------------------------------------
------数据库导出EXCEL-------------
On Error GoTo handles
conn.ConnectionString = sqlconn '使用连接
conn.CursorLocation = adUseClient
conn.Open
Set rst = conn.Execute(sqlstr)
' Dim xlApp As Excel.Application
'
' Dim xlbook As Excel.Workbook
'
' Dim xlsheet As Excel.Worksheet
Dim xlApp As Object
Dim xlbook As Object
Dim xlsheet As Object
Set xlApp = CreateObje