Using ADO as the connection for a ListObject

Dan DeHaven

New Member
Joined
Aug 26, 2009
Messages
45
Using Excel 2010 I want to set the connection of a ListObjects.QueryTable to and ADO source. Under MSDN's info on QueryTable.Connection property they say that "Alternatively, you may choose to access a data source directly by using the Microsoft ActiveX Data objects (ADO) library Instead" of going the ODBC, OLE DB, or Web Data source. But I can't seem to find any info on how to wire this up. I have plenty of experience creating ListObjects with ODBC connections, as well as building ADO connections in Excel but they weren't attached to a ListObject.

Because of the issues with ODBC's having to have an ODBC connection set up outside of Excel I want to use ADO instead so that the end user doesn't have to do anything other than the work in the file itself. But at the same time I still want to utilize Lists/Tables for all the benefits that come along with them.

One other key point is that the Excel file will have cells, which values are used as parameters in the SQL query. So each time the parmeter are changed the connection needs to be refreshed. I've been able to do this with ListObject and ODBC. And with just ADO. But I really want to do it with ListObject and ADO together.

Thanks
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,215,181
Messages
6,123,508
Members
449,101
Latest member
mgro123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top