I do not have an Oracle database to test this, but you should be able to figure this out, and work your way through
Code:
Sub GetData()
Dim strSQL As String
Dim strConnectionString As String
Set con = New ADODB.Connection
Set rst = New ADODB.Recordset
Dim recordCount As Long
strConnectionString = "Provider=msdaora;Data Source=Oracle_Database_Name;User Id=userId;Password=password"
con.ConnectionString = strConnectionString
con.Open strConnectionString 'ConnectionString
strSQL = "Select Employee From MyTable WHERE LOCATION IN ('London','Boston')"
rst.Open strSQL, con
'Do what you need here
rst.Close
End Sub
You could also try to Connect To An Oracle Database Using VBA
Bookmarks