Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pivot Table Help

Status
Not open for further replies.

rkb0378

IS-IT--Management
Mar 12, 2002
16
US
I am using VB code in Access to open an Excel spread sheet that contains a Pivot Table:

Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWB = xlApp.Workbooks.Open("v:\syb\tradesheet.xls", True)

The pivot Table is not refreshing its data from its external links when opening through access. When opening file through excel it refreshs fine. Any help?
 
Try this
For Each pt in Activeworkbook.pivottables
pt.refresh
next pt
Pivot tables don't refresh on open if opened with code (like auto_open macros don't run when opened with code)
HTH
~Geoff~
[noevil]
 
Geoff,

Thanks for the response. I'm new to VB. Could you help me on where to add the code. (Access or Excel (where in Excel))

Thanks again.


Rob
 
Erm - not too sure about VB syntax but something like this should do it:
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWB = xlApp.Workbooks.Open("v:\syb\tradesheet.xls", True)

For Each pt in xlWB.pivottables
pt.refresh
next pt
HTH
~Geoff~
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top