Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SLL SLL is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help With Using Live Data - DDE kylewc Excel Discussion (Misc queries) 0 February 7th 06 02:23 PM
Using Live Data Input Help (DDE) kylewc Excel Discussion (Misc queries) 0 February 7th 06 11:42 AM
How to access live data IndianGuru Excel Programming 1 September 20th 05 08:29 PM
Live data in Excel McSmarty Excel Discussion (Misc queries) 0 August 11th 05 05:10 PM
scrollbar control of a chart, live or not live Brian Murphy[_2_] Excel Programming 2 January 9th 04 11:31 PM


All times are GMT +1. The time now is 08:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"