2
votes

For complex reasons, I want to automate the calling of a Bloomi BQL query in VBA.

I am changing the inputs to a BQL.Query formula in the Excel sheet from a VBA script, and calling Application.Calculate to run the query. The display changes to "N/A Requesting Data ...". In the VBA I wait a bit (using Wait()) and even throw in a DoEvents() for good measure.

While rngOS.Value < 0
   Application.Calculate
   Sleep 2000   'Waits 2000 ms
   DoEvents
Wend

Trouble is, the BQL.Query just doesnt return. Only when I end the VBA script, does the actual data come back into the worksheet.

Ideally I would have a synchronous way to just call BQL.Query from VBA and wait for the return.

All suggestions welcome!

1
Code should be ... - DS_London

1 Answers

2
votes

Here is a pointer: https://stackoverflow.com/a/33667663/829571

In substance: schedule your function to run a bit later, check if BQL is done (for example by counting the number of "N/A Requesting Data") and if not done, schedule the function a bit later again, etc. Once the count of N/As is down to 0, you know the update is finished and you can proceed with the rest of your code.