Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping, but with Live Data
Hi All-
I'm looking for some ideas on how to simultaneously/continuously perform calculations in VBA while receiving live data feeds. I want to run a simple program that has a start and stop button. Basically, I have a live data feed and want to do calcuations and perform other functions only after I have pressed the "Start" button and until I press the "Stop" Button. Pretty simple. My problem is that I dont know entirely how to set this up. Currently, I have all of my calcuations and functionality working correctly, BUT my program is set up to call a Do Until loop when the "Start" button is pressed, and therefore, I am not receiving my live data feeds until I hit "Stop" and it breaks the loop. My code is basic and as follows: Worksheet: Private Sub ResetButton_Click() Worksheets("Front").Range("B3") = "" End Sub Private Sub StopButton_Click() Worksheets("Front").Range("B3") = "" Call MyCalcs(TRUE) End Sub Private Sub StartButton_Click() Call MyCalcs(FALSE) End Sub Module1 Sub MyCalcs(StopProg As Boolean) Do Until StopProg = True 'Instructions, calcuations, etc DoEvents 'Instructions, calcuations, etc Loop End Sub Can anyone point me in the right direction? Thanks. SLL |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping, but with Live Data
Hi, in my opinion, since DoEvents does not work as expected, you can try the
following. Solution 1: 1. Store your live data into a temporary file 2. In your loop read data from the file and at the end of the loop wait for sometime Solution 2: 1. Call a function that will get the data from the live data and process appropriately during each iteration of the loop "SLL" wrote: Hi All- I'm looking for some ideas on how to simultaneously/continuously perform calculations in VBA while receiving live data feeds. I want to run a simple program that has a start and stop button. Basically, I have a live data feed and want to do calcuations and perform other functions only after I have pressed the "Start" button and until I press the "Stop" Button. Pretty simple. My problem is that I dont know entirely how to set this up. Currently, I have all of my calcuations and functionality working correctly, BUT my program is set up to call a Do Until loop when the "Start" button is pressed, and therefore, I am not receiving my live data feeds until I hit "Stop" and it breaks the loop. My code is basic and as follows: Worksheet: Private Sub ResetButton_Click() Worksheets("Front").Range("B3") = "" End Sub Private Sub StopButton_Click() Worksheets("Front").Range("B3") = "" Call MyCalcs(TRUE) End Sub Private Sub StartButton_Click() Call MyCalcs(FALSE) End Sub Module1 Sub MyCalcs(StopProg As Boolean) Do Until StopProg = True 'Instructions, calcuations, etc DoEvents 'Instructions, calcuations, etc Loop End Sub Can anyone point me in the right direction? Thanks. SLL |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help With Using Live Data - DDE | Excel Discussion (Misc queries) | |||
Using Live Data Input Help (DDE) | Excel Discussion (Misc queries) | |||
How to access live data | Excel Programming | |||
Live data in Excel | Excel Discussion (Misc queries) | |||
scrollbar control of a chart, live or not live | Excel Programming |