VBA Access and Excel

J

Jimmy

How would I write an Open event to run a macro when I open the workbook/pivot
table and the stored data will refresh? I'm pulling the information from a
query into a pivot table.
 
O

oeman

Greatings,
this code will refresh your Pivot Table Data. You must write this code in
back of the ThisWorkbook.

Private Sub Workbook_Open()
Worksheets("sheet4").Range("a3").PivotTable.RefreshTable
End Sub

in access,
you must create a new Macro with Requery command. save named as "autoexec"
you will open th database and your macro will run.
if you want this macro run on you ll open form, come to Form Event, on Load
Event, you choose this macro.
 
Top