Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Refreshing Query Tables

Suspect this is in a sheet module in which case, the unqualified references
will remain pointed at the sheet containing the module rather than the
activesheet (which is your intent). The revision below should work if my
assumption is correct.

For Each ws In Worksheets
' ws.Activate
For Each ws.query In QueryTables
ws.query.Refresh BackgroundQuery:=False
Next
Next


--
Regards,
Tom Ogilvy

"Simon Shaw" wrote in message
...
I am trying to run a macro to refresh all query tables in my sheet. I am
using the following code, but it does not seem to update the tables, but

it
doesn't error out either. any ideas?

For Each ws In Worksheets
ws.Activate
For Each query In QueryTables
query.Refresh BackgroundQuery:=False
Next
Next



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Refreshing Query Tables


"Tom Ogilvy" wrote in message
...
Suspect this is in a sheet module in which case, the unqualified

references
will remain pointed at the sheet containing the module rather than the
activesheet (which is your intent). The revision below should work if my
assumption is correct.

For Each ws In Worksheets
' ws.Activate
For Each ws.query In QueryTables
ws.query.Refresh BackgroundQuery:=False
Next
Next


For Each query In ws.QueryTables
query.Refresh False
Next query

?

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Refreshing Query Tables

Yep, went brain dead for a minute.

Thanks for the correction.

--
Regards,
Tom Ogilvy

"Dick Kusleika" wrote in message
...

"Tom Ogilvy" wrote in message
...
Suspect this is in a sheet module in which case, the unqualified

references
will remain pointed at the sheet containing the module rather than the
activesheet (which is your intent). The revision below should work if

my
assumption is correct.

For Each ws In Worksheets
' ws.Activate
For Each ws.query In QueryTables
ws.query.Refresh BackgroundQuery:=False
Next
Next


For Each query In ws.QueryTables
query.Refresh False
Next query

?

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.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
Refreshing an Excel Query DWIGHTBALLMORRILL Excel Discussion (Misc queries) 1 March 4th 08 06:38 PM
Refreshing Pivot Tables hnyb1 Excel Discussion (Misc queries) 1 September 13th 07 01:21 PM
Refreshing Pivot Tables Lisa Excel Worksheet Functions 2 May 17th 07 04:19 PM
Refreshing Query Tables FSt1 Excel Programming 0 August 26th 04 03:16 PM
Refreshing Pivot Tables QUery Ron McCormick[_2_] Excel Programming 1 December 3rd 03 06:31 PM


All times are GMT +1. The time now is 07:39 AM.

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

About Us

"It's about Microsoft Excel"