ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.Ontime help (Excel 2003) (https://www.excelbanter.com/excel-programming/373794-application-ontime-help-excel-2003-a.html)

[email protected]

Application.Ontime help (Excel 2003)
 
No sure if anyone have the same experience. Basically, I have to use
Application.Ontime to get market data from Bloomberg, and I know
Application.Ontime is the only valid way from what I searched.

Okay, here is the problem :

I have a Bloomberg module using Application.Ontime to control and make
sure I get the market data.

Private Sub StartTimer()
RunWhen_bb = Now + TimeSerial(0, 0, cRunIntervalSeconds_bb)
Application.OnTime earliesttime:=RunWhen_bb,
procedu=cRunWhat_bb, schedule:=True
End Sub

Private Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen_bb, procedu=cRunWhat_bb,
schedule:=False
End Sub

.... and I am calling this module/function from another module. My
problem is that it looks like there is no way to make sure the
Bloomberg module is finished before the "on-going" code runs. As I
shown in the following, I used infinite loop and try to make sure I get
Bloomberg data before I proceed. But what I found was that, the
procedure triggered by Application.Ontime function will NOT run, usless
I EXIT THE LOOP...

Sub A()
Dim done As Integer
done = 0
Do While done = 0
If (iRunCnt_bb = 0) Then
' run bb
Call bb_Main
ElseIf (iRunCnt_bb = maxRun_bb) Then
done = 1
End If
Loop

' Code depend on bb_Main....

End Sub

Appreciate if someone can share some experience.



All times are GMT +1. The time now is 01:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com