Home Microsoft Excel Tips Fixed: Error ADODB.Connection User-defined type not defined
Author:

While I was try trying to query some data from SQL Server 2005 in Excel VBA Macro I get an error:

---------------------------
Microsoft Visual Basic
---------------------------
Compile error:

ADODB.Connection User-defined type not defined
---------------------------
OK   Help  
---------------------------

To fix this problem I just need to add a reference to the project. Here's how:

1. Click on Tools.

2. Click on References....

3. Ensure you have Microsoft ActiveX Data Objects selected.

vba-macro-data-object

Now try to run your Macro again and you should not encouter the error.



Comments (0)
Write comment
Your Contact Details:
Comment:
Security
Please input the anti-spam code that you can read in the image.

"