我是这样写的
'声明API函数 
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Dim cnn1 As Connection
Dim strcnn As String
' 打开连接。
Set cnn1 = New ADODB.Connection
strcnn = "DRIVER={Microsoft ODBC for Oracle};UID=system;PWD=manager;"
cnn1.Open strcnn’在此以前都应该是对的cnn1.Execute "SELECT * INTO [Excel 10.0;DATABASE=c:\MyExcel.xls].[WorkSheet1] FROM system.userlogrecord"
‘系统在此报告无效字符,调试,cnn1.execute....黄亮End Sub用的是office2000,我已经引用了EXCEL 10.0,数据库是ORACLE8.05

解决方案 »

  1.   

    Dim cnn1 As Connection
    Dim strcnn As String
    Dim rs as ADODB.Recordset' 打开连接。
    Set cnn1 = New ADODB.Connection
    strcnn = "DRIVER={Microsoft ODBC for Oracle};UID=system;PWD=manager;"
    cnn1.Open strcnn   Set rs = conn.Execute("Orders", , adCmdTable)
       
       'Create a new workbook in Excel
       Dim oExcel As Object
       Dim oBook As Object
       Dim oSheet As Object
       Set oExcel = CreateObject("Excel.Application")
       Set oBook = oExcel.Workbooks.Add
       Set oSheet = oBook.Worksheets(1)
       
       'Transfer the data to Excel
       oSheet.Range("A1").CopyFromRecordset r
      

  2.   

    Set rs = conn.Execute("Orders", , adCmdTable)
    是什么意思?执行到此句,系统报告“表或视图不存在”  oSheet.Range("A1").CopyFromRecordset r
    上面这居是不是没写完啊?