ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Refresh with VBA(SQL) created Pivot (https://www.excelbanter.com/excel-programming/290785-re-how-refresh-vba-sql-created-pivot.html)

Paul LaPlant

How to Refresh with VBA(SQL) created Pivot
 

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!

Richard[_26_]

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


All times are GMT +1. The time now is 12:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com