Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default RefreshAll not quick enough

Help!

I have the following lines of code:

'-----------------------------------------------
ThisWorkbook.RefreshAll

If Range("Input_Date_Flash") <= Range("Access_LatestDate") Then
'blah blah
End If
'-----------------------------------------------

When the workbook refreshes, the range("Access_LatestDate") which
contains a query into an Access file refreshes after the next line of
code executes!

Do I need to add in a line below the line ThisWorkbook.RefreshAll, or
am I just going about this in the wrong way?

Any help greatly appreciated,
Jason.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default RefreshAll not quick enough

Your problem is your backgroundquery option for your queries. Set these to
false and your code will wait for the query update to finish.

If you don't want to change that parameter in the query itself you can
override it with the refresh command (but not the refresh all command)

Activesheet.queryTables(1).Refresh Backgroundquery:=false

as an example.

--
Regards,
Tom Ogilvy


"WhytheQ" wrote:

Help!

I have the following lines of code:

'-----------------------------------------------
ThisWorkbook.RefreshAll

If Range("Input_Date_Flash") <= Range("Access_LatestDate") Then
'blah blah
End If
'-----------------------------------------------

When the workbook refreshes, the range("Access_LatestDate") which
contains a query into an Access file refreshes after the next line of
code executes!

Do I need to add in a line below the line ThisWorkbook.RefreshAll, or
am I just going about this in the wrong way?

Any help greatly appreciated,
Jason.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default RefreshAll not quick enough

nice one Tom: spot on as per usual
(out of interest: how much time each day do you donate to this forum?)

Jason.



Tom Ogilvy wrote:
Your problem is your backgroundquery option for your queries. Set these to
false and your code will wait for the query update to finish.

If you don't want to change that parameter in the query itself you can
override it with the refresh command (but not the refresh all command)

Activesheet.queryTables(1).Refresh Backgroundquery:=false

as an example.

--
Regards,
Tom Ogilvy


"WhytheQ" wrote:

Help!

I have the following lines of code:

'-----------------------------------------------
ThisWorkbook.RefreshAll

If Range("Input_Date_Flash") <= Range("Access_LatestDate") Then
'blah blah
End If
'-----------------------------------------------

When the workbook refreshes, the range("Access_LatestDate") which
contains a query into an Access file refreshes after the next line of
code executes!

Do I need to add in a line below the line ThisWorkbook.RefreshAll, or
am I just going about this in the wrong way?

Any help greatly appreciated,
Jason.



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
ActiveWorkbook.RefreshAll teepee[_3_] Excel Discussion (Misc queries) 0 November 11th 08 02:11 PM
ActiveWorkbook.RefreshAll Matt Cromer[_2_] Excel Programming 3 July 24th 06 08:45 PM
ActiveWorkbook.RefreshAll toosie Excel Programming 1 February 16th 05 09:55 AM
RefreshAll Data with VBA JasonSelf[_4_] Excel Programming 2 January 25th 04 09:52 PM
ActiveWorkbook.RefreshAll Mark[_22_] Excel Programming 0 October 15th 03 02:22 AM


All times are GMT +1. The time now is 03:36 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"