Release Control While Waiting

VenturSum

Board Regular
Joined
May 23, 2010
Messages
138
Team,

I use Excel to process a stream of data from a server.
The data is continuously 'pushed' to my computer.
The code that interperets the stream runs when other VBA processes are done running and released.

I have some VBA code that runs continuously.
I'd like the code to "appear" to have ended so the stream of data can be processed.

I use this code to stop and wait 10 seconds..
But VBA control is not released, so the stream is not processed.

Code:
If Application.Wait(Now + TimeValue("0:00:10")) Then
End If
Any thoughts if this is the right method??
What about VBA releasing control or handing off control??

Any comments greatly appreciated.

John,
In Annapolis, MD
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
What is your continously rumnning VBA code doing? Maybe you could use the OnTime method at the end of the macro to call the procedure again after giving the stream time to finish.

Also, the DoEvents function yields execution so that the operating system can process other events.
 
Upvote 0
Andrew,

I'm trying to receive a stream of stock market prices pushed to my PC by my brokers VBA add-in. There is a limit of 200 stock prices that can be pushed or advised to my PC at any one time. But I'd like to import a much larger set of prices.

So I create a loop with-in a loop.
1) unadvise to clear the list of advise symbols
2) add 100 symbols to the advise list
3) wait 30 seconds while the symbols are updated.
4) repeat steps 1-3 for the balance of the list of symbols.

The problem is while waiting per the above code, the top VBA loop never finishes, so the updating during the 30 second pause does nothing.

Thoughts?

John,
In Annapolis
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top