ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Automatic refresh of pivot tables (https://www.excelbanter.com/excel-discussion-misc-queries/154853-automatic-refresh-pivot-tables.html)

dan

Automatic refresh of pivot tables
 
I am looking for an automatic procedure to open a file (excel 2003), refresh
all pivot tables (olap cubes) and save it.
thanks


Wigi

Automatic refresh of pivot tables
 
Hi

Sub OpenUpdatePivotTablesSave()

Dim pt As PivotTable
Dim ws As Worksheet
Dim wb As Workbook

Set wb = Workbooks.Open("C:\Myfile.xls")

For Each ws In wb.Worksheets

For Each pt In ws.PivotTables
pt.RefreshTable
Next pt

Next ws

wb.Save

End Sub


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Dan" wrote:

I am looking for an automatic procedure to open a file (excel 2003), refresh
all pivot tables (olap cubes) and save it.
thanks


dan

Automatic refresh of pivot tables
 
Thanks Wigi. it works


"Wigi" wrote:

Hi

Sub OpenUpdatePivotTablesSave()

Dim pt As PivotTable
Dim ws As Worksheet
Dim wb As Workbook

Set wb = Workbooks.Open("C:\Myfile.xls")

For Each ws In wb.Worksheets

For Each pt In ws.PivotTables
pt.RefreshTable
Next pt

Next ws

wb.Save

End Sub


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Dan" wrote:

I am looking for an automatic procedure to open a file (excel 2003), refresh
all pivot tables (olap cubes) and save it.
thanks



All times are GMT +1. The time now is 09:13 AM.

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