View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jean-Yves[_2_] Jean-Yves[_2_] is offline
external usenet poster
 
Posts: 253
Default 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?

...