VB Script help

Q

Quanchi

Hello all,

I need some help. I have an Excel XP spreadsheet with a couple of
pivot tables. I have the tables set not to automatically refresh
because they connect to an Oracle datbase via a ODBC connection and
some users use the file while on the road.

I want to add a command button to the spreadsheet that the user can
click to refresh all pivot tables in the spreadsheet. Yes, i know that
there are tool bars for this, but all users dont have the needed tool
bars enabled and I wanted to make it really easy for everybody by
adding the button in the spreadsheet.

So, can anybody give me an example of the VB code for the click event
to refresh all pivot tables in my Excel file?

Thanks in advance,

Quanchi
 
K

Kristen Lindholm

See if this works for you:

Dim pc As Excel.PivotCache

For Each pc In ActiveWorkbook.PivotCaches
pc.Refresh
Next pc
 

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