Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ActiveWorkbook.RefreshAll | Excel Discussion (Misc queries) | |||
ActiveWorkbook.RefreshAll | Excel Programming | |||
ActiveWorkbook.RefreshAll | Excel Programming | |||
RefreshAll Data with VBA | Excel Programming | |||
ActiveWorkbook.RefreshAll | Excel Programming |