I'm trying to place a bet using the com function "placeBet " asynchronous and get the bet details from the betPlaced event that will rise
The bet is fired ok ( matched, cancelled etc) but no betPlaced event rises
the code in a module is:
- Code: Select all
Public ba As New BettingAssistantCom.ComClass
Sub testbet1()
If ba Is Nothing Then
Set ba = New BettingAssistantCom.ComClass
ba.tabIndex = 1
Else
ba.tabIndex = 1
End If
ba.placeBet 1, "B", 5, 2, False, "", 10
End Sub
and in sheet1 object is:
- Code: Select all
Public WithEvents ba As BettingAssistantCom.ComClass
Public Sub ba_betPlaced(ByVal ref As String, ByVal selecId As Long, ByVal avgPriceMatched As Double, ByVal sizeMatched As Double, ByVal resultCode As String, ByVal token As String)
ThisWorkbook.Sheets("Sheet2").Range("AA1") = selecId & "/" & avgPriceMatched & "/" & sizeMatched
Debug.Print selecId & "/" & avgPriceMatched & "/" & sizeMatched
End Sub
I tried to change from public to Dim the events or place them in sheet2 but with no success
The "Sub ba_betPlaced(ByVal ref As String, By ...." is taken from Garrys' file "PlaceBet_Async.xlsm"
Garry/Mark/anyone ???