I have an excel file with 4 sheets. Each sheet contains a pivot table that connects to an Oracle database. I need all pivot tables to update automatically at 4 am. To do this I have a macro. The problem is the macro asks me to select a data source manually. Is there a way the macro select the data source automatically?
When I execute the macro, it shows me this window 4 times:
And then:
I need the macro select the one that is marked (PRODUCCION DWH).
This is the macro:
Sub Actualiza_Reporte()
Dim pt As PivotTable
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.RefreshTable
Next pt
Next ws
ThisWorkbook.Save ' Guardamos el archivo
ThisWorkbook.Close ' Para cerrar el archivo
Application.Quit ' Para cerrar Excel
End Sub
I need to update the 4 sheets automatically, without asking me to select the data source.
Thanks and regards.