Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Excel VBA via ADO connection

Hello!
I want to use Excel document connect Access database via ADO Connection.
I claim the following sentence in my program:
Dim conn As ADODB.Connection

It prompt the following error message while I compile my program:
User's type undefine

I lookup Excel's help for ADO Connection. It just pivottable connect Access
database via ADO Connection has been told. This help is no use for me.
Please tell how to use ADO Connection in Excel VBA. Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Excel VBA via ADO connection


To use the ADO data types and procedures you first need to establish a
reference to the MS-ADO Library. This library contains all the "code" that
handles ADO connections for you.

In the VBA editor (alt-F11) go to Tools References tick the box next to
Microsoft Active Data Objects 2.x library.

If you've never used ADO connections in VBA or VB before I suggest that you
search the internet for a tutorial. I'm sure there's heaps out there.

- Rm


"Terry" wrote:

Hello!
I want to use Excel document connect Access database via ADO Connection.
I claim the following sentence in my program:
Dim conn As ADODB.Connection

It prompt the following error message while I compile my program:
User's type undefine

I lookup Excel's help for ADO Connection. It just pivottable connect Access
database via ADO Connection has been told. This help is no use for me.
Please tell how to use ADO Connection in Excel VBA. Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA via ADO connection


How would one add this using VBA? Ive been searching around on how to
add a reference using VBA (which is how I came across this thread) but
havent been able to find out how...

Thanks a bunch.


--
durex
------------------------------------------------------------------------
durex's Profile: http://www.excelforum.com/member.php...o&userid=27857
View this thread: http://www.excelforum.com/showthread...hreadid=488554

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Excel VBA via ADO connection

Alright, I find it hard to believe that there isn't a tutorial on the net
that describes how to do this, but I'll write one on my train trip home
tonight. I'm not promising a great deal of detail but it should be enough to
get you started. Check back here tomorrow.

- Rm

"durex" wrote:


How would one add this using VBA? Ive been searching around on how to
add a reference using VBA (which is how I came across this thread) but
havent been able to find out how...

Thanks a bunch.


--
durex
------------------------------------------------------------------------
durex's Profile: http://www.excelforum.com/member.php...o&userid=27857
View this thread: http://www.excelforum.com/showthread...hreadid=488554


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA via ADO connection


Robert Mulroney Wrote:
Alright, I find it hard to believe that there isn't a tutorial on the
net
that describes how to do this, but I'll write one on my train trip
home
tonight. I'm not promising a great deal of detail but it should be
enough to
get you started. Check back here tomorrow.

- Rm


There very well could be, but I scoured these forums, google web and
google group and couldnt find any definitive answer that actually
worked. Thanks a bunch.


--
durex
------------------------------------------------------------------------
durex's Profile: http://www.excelforum.com/member.php...o&userid=27857
View this thread: http://www.excelforum.com/showthread...hreadid=488554



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA via ADO connection


Ok.. so in researching this issue, pretty much everything Ive found
references something simliar to the following code to find the GUID of
the reference library I want to use:

Code:
--------------------

Sub Grab_Reference()
Dim myRef As Reference
On Error Resume Next
Set myRef = References(5)
If Not myRef Is Nothing Then
Debug.Print myRef.Name & vbLf & """" & myRef.Guid & """" & ", " & _
myRef.Major & ", " & myRef.Minor & vbLf & _
myRef.FullPath
End If
Set myRef = Nothing
End Sub

--------------------



... but for whatever reason when I run it (in Excel VBA) I get
"User-defined type not defined" which is referring to type
"reference".

Any ideas?


--
durex
------------------------------------------------------------------------
durex's Profile: http://www.excelforum.com/member.php...o&userid=27857
View this thread: http://www.excelforum.com/showthread...hreadid=488554

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Excel VBA via ADO connection


Just to let you know I have emailed an example of how to do an ADO
connection to to at the address on your profile. Let me know if you don't get
it.

If anyone else reads this I wil be puttnig it up on the web at some stage. I
don't have any web space at the moment but I'll look for some today and post
the link here when I have it.

- Rm

"durex" wrote:


Robert Mulroney Wrote:
Alright, I find it hard to believe that there isn't a tutorial on the
net
that describes how to do this, but I'll write one on my train trip
home
tonight. I'm not promising a great deal of detail but it should be
enough to
get you started. Check back here tomorrow.

- Rm


There very well could be, but I scoured these forums, google web and
google group and couldnt find any definitive answer that actually
worked. Thanks a bunch.


--
durex
------------------------------------------------------------------------
durex's Profile: http://www.excelforum.com/member.php...o&userid=27857
View this thread: http://www.excelforum.com/showthread...hreadid=488554


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA via ADO connection


I didnt get it... would you mind resending it to: tgraffam at gmail dot
com?

Thanks!


--
durex
------------------------------------------------------------------------
durex's Profile: http://www.excelforum.com/member.php...o&userid=27857
View this thread: http://www.excelforum.com/showthread...hreadid=488554

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
always recheck data connection library for latest connection strin FurmanGG Excel Discussion (Misc queries) 0 September 14th 07 04:48 PM
Database Connection from Excel Lost! Excel Programming 1 August 31st 04 02:19 AM
Excel/Access connection via ADO Loane Sharp Excel Programming 1 August 10th 04 01:17 PM
Excel/Access connection via ADO Loane Sharp Excel Programming 1 August 10th 04 12:15 PM
no connection to excel envisys Excel Programming 0 October 30th 03 04:42 AM


All times are GMT +1. The time now is 01:54 PM.

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

About Us

"It's about Microsoft Excel"