ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Newbie : Oracle Data to Excel (https://www.excelbanter.com/excel-programming/336832-newbie-oracle-data-excel.html)

[email protected]

Newbie : Oracle Data to Excel
 

I am using Excel 2002.

I wanted my VBA code to connect to Oracle, do a select statement, and
get data. Then I wanted to put that data into a spreadsheet.

My question is, how do I connect to Oracle via Excel. Is there an
example that I can get that shows me how to do this?

...


Jean-Yves[_2_]

Newbie : Oracle Data to Excel
 
Hio all,


Look for ADO in this group. Example were posted before.
If you don't, please repost.
Regards
JY

'First make a reference via Tool/References .... To Microsoft ActiveX Data
Objects 2.x

Sub test()
Dim connMdb As ADODB.Connection
Dim recMdb As ADODB.Recordset
Dim strStatus As String

Set connMdb = New ADODB.Connection
Set recMdb = New ADODB.Recordset
"open a connection to the DB
connMdb.conn.Open "Provider=MSDAORA;Data Source=theDB", "userID", "password"
recMdb.Open "SELECT Name, Surname FROM STAFF ;", connMdb, adOpenForwardOnly,
adLockOptimistic
Do while recMdb.EOF = False
debug.print recmdb.fields("Name").value & " " &
recmdb.fields("Surname").value
Loop
recMdb.Close
Next cl

connMdb.Close
Set recMdb = Nothing
Set connMdb = Nothing
End Sub

"Dave M." <Dave wrote in message
...
I am also a newbie who just went through this same thing. I have never
worked with Oracle but I'm sure it would be very similar. You will need

to
install an ODBC driver into Excel for your database then you will be able

to
Import External Data Using Excel. After the driver is installed you will

be
able to select your tables and write your query. Good Luck!



" wrote:


I am using Excel 2002.

I wanted my VBA code to connect to Oracle, do a select statement, and
get data. Then I wanted to put that data into a spreadsheet.

My question is, how do I connect to Oracle via Excel. Is there an
example that I can get that shows me how to do this?

...






All times are GMT +1. The time now is 05:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com