ADODB.Connection via VBA versus PowerPivot

lovallee

Board Regular
Joined
Jul 8, 2002
Messages
220
Hello,

Very often, my data is in one a several Excel tables and I use VBA as follow (except only):

Code:
...
Set MyCon = CreateObject("ADODB.Connection")
Set MyData = CreateObject("ADODB.Recordset")

MyConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
                    "Data Source=" & MainSourceFile & ";" & _
                    "Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"

MyCon.Open MyConnectionString
MyData.Open MySQL, MyCon, adCmdText

Set objPivotCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
Set objPivotCache.Recordset = MyData
...

...which allows me to manually write an SQL query to join Excel tables, add calculated fields and export the results in a PivotTable cache. As an experiement, I converted one of my projects to PowerPivot, replicating the manually written SQL query using the PowerPivot "wizard". Conclusion: Both ADODB.Recordset and PowerPivot methods take the exact same time to refresh (about 30 seconds).

My question:
What are the advantages of using PowerPivot versus ADODB.Recordset and a manual SQL query? Is it just that the PowerPivot interface is more user-friendly (i.e. works like a "wizard")? Thanks
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
You probably want to compare what you're doing in VBA to Power Query, not Power Pivot.

Power Query is a data extraction and ETL utility like SSIS whereas Power Pivot is a data modeling utility that allows you to relate multiple data sets to each other and write cube formulas against them.
 
Upvote 0

Forum statistics

Threads
1,224,096
Messages
6,176,320
Members
452,721
Latest member
Du Toit

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