#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default ADO/VBA

Brent,

You don't need the line with Set because your declaration line for cn
already creates it as a New ADODB.Connection object.

You need to use a properly constructed connection string for the Open
method. Since you mentioned you're trying to connect to Oracle, you'll need
something like this:

cn.Open "Provider=msdaora;Data Source=MyOracleDB;User
Id=myUsername;Password=myPassword;"


Follow this link for list of other connection strings you can use to connect
to Oracle:

http://www.connectionstrings.com/?carrier=oracle


Also, make sure you have reference to the Microsoft ActiveX Data Objects 2.x
Library, depending which version you have installed in your computer.


--
Hope that helps.

Vergel Adriano


"Brent" wrote:

I am trying to interface to export Excel data into Oracle direclty. In
attempting this I keep gettig errors. The lines below with an asterix are
the problem lines.

Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
* Set cn = ADODB.OpenConnection
* cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;"

At Set I get "Invalid Outside Procedure". If I remove the line containing
Set, I get the same error at cn.Open. Any suggestions? Could it be my
references? Any help would be greatly appreciated!!

Brent

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"