![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 10:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com