I have been fighting with this one, we have a excel report that use PowerPivot to connect to multiple data sources and using VBA a Refresh button that updates the data. This is working but there is a slight twist, we also have a Parameters sheet that the user can enter values that are used to calculate some of the columns, this is done using PowerPivot Linked tables.
The problem is that the LinkedTable only get updated if the user does a 'Update All' under PowerPivot ribbon or open the PowerPivot Window. I need to in VBA get a hande to the LinkedTable and trigger a refresh before the rest of the refresh logic is excecuted.
Some things I have tried:
Sheets("Parameters").ListObjects("{LinkedTableName}").QueryTable.Refresh BackgroundQuery:=False
Sheets("Parameters").Range("{LinkTableRange}").ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Parameters").PivotTables("{LinkedTableName}").Update
I can get a handle on the ListObject but everytime I get to the QueryTable it bombs out with Application-defined or object-defined error. It almost seeks like it want me to go through a database connection, but that does not make sense. My LinkTable is a local excel table so it should refresh into PowerPivot data without going anywhere.
Any help will be appreciated!