I'm trying to avoid putting DDE links directly into Excel cells and instead establish the links in VBA and store the returned data into a VBA array. I'm getting tripped up on the very first step however, because I can't establish the DDE links in VBA (and as a result receive no data to populate my array with). Here is what I am trying to use into to get the market data via DDE:
Sub GetMktData()
Dim chan As Long, App as String, Topic as String, data As Variant, Item as String
App = "Account123"
Topic = "tik"
Item = "id1?bid"
chan = Application.DDEInitiate( App, Topic )
data = Application.DDERequest( chan, Item )
MsgBox(data(1))
Application.DDETerminate chan
End Sub
I've tried numerous variations of 'Item', but 'data' always returns as empty. (I suspect that the problem lies in what I am using for 'Item', but I'm not certain.) Does anyone have suggestions on how I can get this to work or what I'm doing wrong? Could be a problem with the general approach, but my feeling is that it is an IB specific syntax issue. I've tried gettting answers from IB customer service but would have been better off using a ouija board. Appreciate any suggestions.
Sub GetMktData()
Dim chan As Long, App as String, Topic as String, data As Variant, Item as String
App = "Account123"
Topic = "tik"
Item = "id1?bid"
chan = Application.DDEInitiate( App, Topic )
data = Application.DDERequest( chan, Item )
MsgBox(data(1))
Application.DDETerminate chan
End Sub
I've tried numerous variations of 'Item', but 'data' always returns as empty. (I suspect that the problem lies in what I am using for 'Item', but I'm not certain.) Does anyone have suggestions on how I can get this to work or what I'm doing wrong? Could be a problem with the general approach, but my feeling is that it is an IB specific syntax issue. I've tried gettting answers from IB customer service but would have been better off using a ouija board. Appreciate any suggestions.
