Eccoware VB question

fiftyfifty

Member
Messages
85
Likes
2
I'm sorry about this thread, I've very limited VB and can't really make head nor tail of the instructions in the Automation document.

I want to just do a CancelAll in VB, for some reason I can't figure this out but it seems like it should be really obvious. I've loaded up the reference Ecco Library. But I don't know what to do from here. I've put in the following code (from Ecco example)

Dim WithEvents MyOB As Ecco_OrderBook
Set MyOB = New Ecco_OrderBook

the exact coding from the automation guide wouldn't go in as it wouldn't allow "As New Ecco_OrderBook" in the first line.

Don't know whether this should all be in a sub or what. I probably shouldn't even be attempting this but figure if I can get the very basics right then it should be easy to build onto.

Cheers for any help received.
 
I have some Ecco API code (sorry, can't share). It's in C# but it should be very similar I think...

In C# you need to define an Ecco.Application (called eccoApp say) and an Ecco_OrderBook (called orderBook say). Then use "eccoApp = new Ecco.ApplicationClass()" to create an instance of Ecco or get a currently running instance, and use "orderBook = eccoApp.OrderBook" to get the Ecco's OrderBook object.
 
suspect fatchance is on the right track
WithEvents keyword can only be used in a Class Module.
therefore looks you have to write a "wrapper" class for the object

this is a primer for excel vba but the vb syntax should be very very similar

Classes In VBA
 
problem is the withevent comment, but as all your doing is creating a cancelall, you don't need to worry about it, drop the withevents, try

Dim EccoApp as New Ecco.Application
Dim OB as New EccoApp.Orderbook
OB.CancelAll

or something similar, basically you should be able to do this in a single function call.
 
Top