VBA Access and Excel

G

Guest

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top