...b but not the non-realtime data. Hoping the form doesn't munge the code from this editor.
Option Explicit
Private Sub Form_Load()
Me.WindowState = vbMaximized
End Sub
Sub Sleep_DoEvents(msg As String, Optional Milliseconds As Long = 3000)
Dim tc As Long
Form1.Caption = msg
tc = GetTickCount
While GetTickCount < tc + Milliseconds
Sleep 1
DoEvents
Wend
End Sub
Private Sub cmdNonRealtime_Click()
Dim MyEikonDDA As EikonDesktopDataAPI
Dim MyDex2Mgr As Dex2Mgr
Dim MyRData As Dex2Lib.RData
Dim MyDex2Cookie As Long
Dim MyFieldList As Variant
Dim MyItemList As Variant
Dim msg As String
Dim EikonInitResult As EikonDesktopDataAPILib.EEikonDataAPIInitializeResult
Dim Value_Returned
Dim DataStatus As Dex2Lib.DEX2_DataStatus
Dim MyRequestParamList As Variant
MyFieldList = "TR.CompanyName"
MyItemList = "GS"
MyRequestParamList = ""
Set MyEikonDDA = New EikonDesktopDataAPI
msg = "Waiting after Set EikonDDA = New EikonDesktopDataAPI"
Sleep_DoEvents msg, Milliseconds:=SLEEP_LENGTH
EikonInitResult = MyEikonDDA.Initialize
If EikonInitResult = Error_InitializeFail Then
MsgBox "The result of EikonDDA.Initialize was Error_InitializeFail, end"
End
End If
If EikonInitResult = Error_Reinitialize Then
MsgBox "The result of EikonDDA.Initialize was Error_Reinitialize, end"
End
End If
If EikonInitResult = Succeed Then
MsgBox "The result of EikonDDA.Initialize was Succeed, continue"
End If
msg = "Waiting after EikonDDA.Initialize"
Sleep_DoEvents msg, Milliseconds:=SLEEP_LENGTH
If EikonInitResult = Error_InitializeFail Then
'Handle fail case here
ElseIf EikonInitResult = Error_Reinitialize Then
'Handle reinitialize case here
End If
msg = "Waiting before EikonDDA.CreateDex2Mgr"
Sleep_DoEvents msg, Milliseconds:=SLEEP_LENGTH
Set MyDex2Mgr = MyEikonDDA.CreateDex2Mgr()
msg = "Waiting after Set MyDex2Mgr = EikonDDA.CreateDex2Mgr"
Sleep_DoEvents msg, Milliseconds:=SLEEP_LENGTH
MyDex2Cookie = MyDex2Mgr.Initialize(DE_MC_ADC_POWERLINK)
msg = "Waiting after MyDex2Mgr.Initialize"
Sleep_DoEvents msg, Milliseconds:=SLEEP_LENGTH
Set MyRData = MyDex2Mgr.CreateRData(MyDex2Cookie)
msg = "Waiting after MyDex2Mgr.MyDex2Mgr.CreateRData"
Sleep_DoEvents msg, Milliseconds:=SLEEP_LENGTH
MyRData.FieldList = MyFieldList
MyRData.InstrumentIDList = MyItemList
MyRData.DisplayParam = "RH:In CH:Fd"
MyRData.RequestParam = MyRequestParamList
MyRData.Subscribe
msg = "Waiting after MyRData.Subscribe"
Sleep_DoEvents msg, Milliseconds:=SLEEP_LENGTH
If MyRData Is Nothing Then
Else
Value_Returned = MyRData.Data(1, 1)
' ?err.Description
' Method 'Data' of object 'IRData' failed
MsgBox Value_Returned
End If
End Sub