View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Richard[_26_] Richard[_26_] is offline
external usenet poster
 
Posts: 1
Default How to Refresh with VBA(SQL) created Pivot

Paul LaPlant wrote in message ...
Charles, I looked at that and I don't think that will solve my problem.
I understand that will recreate the sheet and the pivottable, but I
don't want to recreate it each time, I just want to be able to refresh
it so that other pivottables that use the same source can be refreshed
as well. I don't think this method will address that at all.

Thanks


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


After creating a pivottable using your code, to refresh, recreate your
connection and recordset, then use the following code (changing
"PivotCaches(1)") to refer to the pivotcache you created.

Set objPivotCache = ActiveWorkbook.PivotCaches(1)
Set objPivotCache.Recordset = rsInfo
objPivotCache.Refresh