ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Oralce Connection (https://www.excelbanter.com/excel-programming/352423-oralce-connection.html)

Jim Heavey

Oralce Connection
 
I am trying to translate the code generated by the macro recorder to straight
vb code where i can caret and manage the code my self. I know that I have
an Oracle driver installed.

Anyway I am not sure what type of a provider I should be using, I persume
something which would say Oracle, but I do not see that generated in the
code. Here is what was generated.

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _

"ODBC;DSN=PRG_OPS;UID=YYYYYYYY;PWD=XXXXXXX;DBQ=EDS SP.WORLD;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL= 10;LOB=T;RST=T;GDE=F;FRL=F;BAM

When I attempt to write the code like the following:

Dim cnn As New ADODB.Connection
Dim strCnn As String
Dim iTry As Integer

strCnn = "Provider=OraOLEDB.Oracle.1;Password=operations;Us er
ID=PRG_OPS;Data Server=EDSSP.WORLD;Persist Security Info=True"

The compiler stops on the Dim Statement (New ADODB.Connection). Why does it
not recognize this?

Am I using the provider?



Tim Williams

Oralce Connection
 
You must add a reference to the ADO object library (or use late binding).

To add a reference go to Tools References

To use late binding:

Dim cnn As Object
set cnn = createobject("ADODB.Connection")

Tim


"Jim Heavey" wrote in message
...
I am trying to translate the code generated by the macro recorder to
straight
vb code where i can caret and manage the code my self. I know that I have
an Oracle driver installed.

Anyway I am not sure what type of a provider I should be using, I persume
something which would say Oracle, but I do not see that generated in the
code. Here is what was generated.

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _

"ODBC;DSN=PRG_OPS;UID=YYYYYYYY;PWD=XXXXXXX;DBQ=EDS SP.WORLD;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL= 10;LOB=T;RST=T;GDE=F;FRL=F;BAM

When I attempt to write the code like the following:

Dim cnn As New ADODB.Connection
Dim strCnn As String
Dim iTry As Integer

strCnn = "Provider=OraOLEDB.Oracle.1;Password=operations;Us er
ID=PRG_OPS;Data Server=EDSSP.WORLD;Persist Security Info=True"

The compiler stops on the Dim Statement (New ADODB.Connection). Why does
it
not recognize this?

Am I using the provider?






All times are GMT +1. The time now is 03:36 AM.

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