Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Keep the Enable Refresh option (VBA, SQL)

Greetings. I have created a PivotTable using VBA and connecting to a
SQL database. The Pivot is created fine, but I cannot refresh the
PivotTable. I cannot simply delete the Pivot or the sheet each time I
need to update the data either, but I cannot figure out what code to
write to KEEP the option to Refresh the data. Basically all I have is
a PivotTable with a snapshot in time of the data and it doesn't help
me because I need to refresh the data often.

Does anyone have any thoughts?

I've been struggling on this one for a while and I'm getting close to
deadlines on some items.

Thanks in advance for any help

Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Keep the Enable Refresh option (VBA, SQL)

Paul,

I haven't seen any response to your request so I found the followin
code in Google. It appears to be what you ar looking for you may hav
to modify it. If this helps the credit goes to the ones who create
it.

HTH
Charles



Sub RefreshTables()
vArr = Array( _
"M:\Data Dir\Project1\MyProject1.xls", _
"M:\Data Dir\Project1\MyProject2.xls", _
"M:\Other Dir\Invoices\MyInvoice.xls", _
"P:\Shared1\SubDir1\SubDir2\Myworbkook.xls")
for i = 1 to ubound(vArr)
set wkbk = Workbooks.Open varr(i)
for each sh in wkbk.Worksheets
for each pt in sh.PivotTables
pt.PivotCache.BackgroundQuery = False
Next
Next
wkbk.RefreshAll
wkbk.Close SaveChanges:=True
Next
End Su

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I 'Enable Automatic Refresh' for Query Refresh by default Anand Deshpande Setting up and Configuration of Excel 0 December 10th 06 04:47 AM
'Enable Automatic Refresh?' Nigel Brown Setting up and Configuration of Excel 0 June 27th 06 05:22 PM
enable automatic refresh Vass Excel Worksheet Functions 2 March 11th 06 04:36 AM
Enable Automatic Refresh Terri Excel Worksheet Functions 1 August 8th 05 11:26 PM
Query Refresh-Enable Automatic Refresh Dialogue Box Terri Excel Discussion (Misc queries) 0 May 6th 05 08:21 PM


All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"