0

I want to execute a bunch of functions, every time a refresh happens on the web query i have on the same excel file. The web query is fetching data every 10 mins and a pivot sits on the data.

How can i write a code in order to refresh the pivot every time the refresh happen automatically? So what i really need is -

OnRefresh() {

update pivot table

}

Thanks!

pnuts
  • 58,317
  • 11
  • 87
  • 139
Tom
  • 135
  • 1
  • 5
  • 14

1 Answers1

0

Use the following code PivotCache.Refresh For e.g.

Worksheets(1).PivotTables(1).PivotCache.Refresh

http://msdn.microsoft.com/en-us/library/office/ff195521%28v=office.15%29.aspx

You can substitute 1 with PivotTableName if you like. Invoke this line in the event triggered by the web-page getting fetched or as the last line of the code doing the refresh.

hnk
  • 2,216
  • 1
  • 13
  • 18