Newbie : Oracle Data to Excel

R

richmarin

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?

...
 
G

Guest

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!
 
J

Jean-Yves

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top