Background refresh not working

G

GorKo

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
 
N

NickHK

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top