![]() |
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! |
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! |
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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 07:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com