Hello all,

I am connecting to oracle and trying to pull data into an excel spreadsheet, however, I am getting an error when I try to use the recordset object. The error is Run-time error -2147217900 (80040e14)': Automation Error

Here is the code up too the line that causes an error


Sub GetOracleData()

' requires a reference to the Microsoft ActiveX Data Objects Library.

    Dim cn                    As ADODB.Connection
    Dim rst                   As ADODB.Recordset
    Dim strQuery              As String
    Dim TR                    As Range
    Dim lngFieldCount         As Long
    Dim i                     As Long

    Application.ScreenUpdating = False

    Set TR = Range("A1")
    Set TR = TR.Cells(1, 1)
    Set cn = New ADODB.Connection
    With cn
       ' .Provider = "OraOLEDB.Oracle"
       .Provider = "MSDAORA.Oracle"
        .ConnectionString = "Data Source=xxxxx;User ID=xxxxxxx;Password=xxxxxxxx; "
        .Open
    End With
    strQuery = "SELECT * FROM awesome;"
    Set rst = New ADODB.Recordset
'    Set rst = Connection.Execute("select * from awesome;")

    rst.Open strQuery, cn