I have 34 pivot tables sharing 6 pivot caches.
Each pivot cache is linked to SQL server query and I update each of the 6 caches by changing the date in MSQuery SQL line. For example, here is how one cache is updated:
exec qryWtd_Index_Ratios_for_Da
te '11/30/2007'
My question: how can I use VBA to either update each of the 34 pivot tables or each of the 6 caches whenever I change the date? I do not want to make a new pivot each time. I want to re-use the existing pivots.
When I record what I want to do I get this but it does not solve my problem:
ActiveSheet.PivotTableWiza
rd SourceType:=xlExternal, SourceData:=Array( _
"exec qryWtd_Index_Ratios_for_Da
te '11/30/2007'"), Connection:=Array(Array( _
"ODBC;DRIVER=SQL Server;SERVER=invest2;UID=
michael;AP
P=Microsof
t Office 2003;WSID=MICHAEL;DATABASE
=Equity Beta Application;Trust" _
), Array("ed_Connection=Yes")
)
Thanks!
Start Free Trial