Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel VBA - RefreshAll not updating pivot tables

I have a template workbook, which has several data tables connected to sql connections, as well as some pivot tables who's sources are the data brought through.

I was under the impression that ActiveWorkbook.RefreshAll would update all connections, then update the pivots. That in fact is what happens when I run the refresh all manually. However, when I run the VBA (which is actually in Access, but is correctly referenced etc) it updates the connections but NOT the pivot tables?

I've tried DoEvents after the RefreshAll which had no effect.

Is my only option now to run a For each through all the worksheets, data sources, pivot caches and refresh them that way?

like image 829
GavinP Avatar asked Feb 01 '16 13:02

GavinP


1 Answers

I have solved the issue by adding a simple 'Calculate' to the code.

Calculate
ActiveWorkbook.RefreshAll
like image 183
BuckTurgidson Avatar answered Oct 09 '22 05:10

BuckTurgidson