View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
westg westg is offline
external usenet poster
 
Posts: 16
Default pausing vba for refresh

Hi Sebastien,

Sorry I am using Query Tables, but you don't want to see the code, it is
huge and i am no programmer so it won't make a lot of sense!

Unfortunately I have had to stop using the Background false method because
it caused other problems in the program (sql syntax error).

Any ways around it?

"sebastienm" wrote:

Hi,
not sure what you are using to run the query; excel's QueryTable (vba
equivalent to menu Data Extrernal Data) or direct ADO?
If you are using the QueryTable/External Data, the Refresh method has a
Background query parameter. Just set it to False to have the code pause and
wait for the query to return:
Dim qt as QueryTable
... set qt...
qt.Refresh False

--
Regards,
Sébastien
<http://www.ondemandanalysis.com

"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