pausing vba for refresh
i have had a brainwave, if i looped around this code until it had finished
refreshing, would that work???
With Worksheets(1).QueryTables(1)
If .Refreshing Then
MsgBox "Query is currently refreshing: please wait"
Else
.Refresh BackgroundQuery := False
.ResultRange.Select
End If
End With
"westg" wrote:
I setup a query on an sql db. However I need the vba to pause while the query
refreshes and brings the data into Excel.
So far I have tried using
Application.Wait Now + TimeSerial(0, 0, 10)
However if a user is daft enough to run a query on huge amount of data, i am
screwed.
is there a way of pausing until the data has finished refreshing?
Many thanks, Andrew
|