ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Background refresh not working (https://www.excelbanter.com/excel-programming/394072-background-refresh-not-working.html)

GorKo

Background refresh not working
 
I attempt to referesh column using the query and it is not happening
as long as macro is running so I can not combine this macro with
following one, what do I do wrong?

Sub UpdateSafety()
'
' UpdateSafety Macro
' Macro recorded 5/4/2007 by dispatch
'
Sheets("Review").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=True

Application.Wait Now + TimeSerial(0, 0, 10)

Sheets("ISC METS").Select
Range("A6").Select

End Sub


NickHK

Background refresh not working
 
I don't understand your logic of attempting a background refresh
(asynchronous) then waiting in code for 10 seconds anyway. Why not just do a
synchronous refresh, so the code waits until the refresh is complete ?

Anyway, it may depend on the type of query that underlies the QT:

<From Help for the Refresh Method
BackgroundQuery Optional Variant. Used only with query tables based on the
results of an SQL query. True to return control to the procedure as soon as
a database connection is made and the the query is submitted (the query is
updated in the background). False to return control to the procedure only
after all data has been fetched to the worksheet. If this argument isn't
specified, the setting of the BackgroundQuery property determines the query
mode.
</From Help for the Refresh Method

NickHK

"GorKo" wrote in message
oups.com...
I attempt to referesh column using the query and it is not happening
as long as macro is running so I can not combine this macro with
following one, what do I do wrong?

Sub UpdateSafety()
'
' UpdateSafety Macro
' Macro recorded 5/4/2007 by dispatch
'
Sheets("Review").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=True

Application.Wait Now + TimeSerial(0, 0, 10)

Sheets("ISC METS").Select
Range("A6").Select

End Sub





All times are GMT +1. The time now is 11:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com