我嘗試使用下面的代碼將數據寫入Excel文件如何從訪問數據寫入到excel文件
Dim objexcel As Excel.Application
Dim wbexcel As Excel.Workbook
Dim wbExists As Boolean
Set objexcel = CreateObject("excel.Application")
objexcel.Visible = True
On Error GoTo Openwb
wbExists = False
Set wbexcel = objexcel.Documents.Open("C:\Documents and Settings\TAYYAPP\Desktop\test folder\ERROR REPORT2.xls")
wbExists = True
Openwb:
On Error GoTo 0
If Not wbExists Then
Set wbexcel = objexcel.Workbook.Add
End If
,但我得到一個運行時錯誤對象不支持屬性或方法在線
Set wbexcel = objexcel.Workbook.Add
我引用了excel對象庫。
感謝該做的工作 也寫入數據,然後 wbexcel.insert「數據」 是這句法OK – tksy 2008-11-11 12:37:52