I am sure this is a common issue, but extensive searches leave me still stuck.
I have a vb.net com add in that successfully returns an object - RaceBook that is a Custom BetFair object. The Racebook contains race data and an array of runners data, and the values are easily exposed within vb.net:
However when I use the same request in VBA I get an "incorrect number of arguments" error.
here is a subset of the Racebook - you can see runners 1 - 3 listed hereCode:Public Function fngetPrices() Dim strMarketID As String strMarketID = "2.101063980" Dim RaceBook As ApiNgClassLib.MarketBook Set oBetfairLib = New ApiNgClassLib.CreateApiCalls Set RaceBook = oBetfairLib.fngetPrices(strMarketID) Debug.Print RaceBook.marketid ' works fine Debug.Print RaceBook.status ' works fine Debug.Print RaceBook.runners(0).selectionid ' error 450 wrong number of arguments End Function
MarketBook : MarketId=2.101063980 : Status=CLOSED : BetDelay=1 : Version=129707980 : Runner[0]=SelectionId=8972613 : Handicap=0 : Status=LOSER : AdjustmentFactor=12.5 : LastPriceTraded= : TotalMatched=0 : RemovalDate=: ExchangePrices : Runner[1]=SelectionId=8972614 : Handicap=0 : Status=LOSER : AdjustmentFactor=6.3 : LastPriceTraded= : TotalMatched=0 : RemovalDate=: ExchangePrices : Runner[2]=SelectionId=6749312 : Handicap=0 : Status=LOSER : AdjustmentFactor=0.5 : LastPriceTraded= : TotalMatched=0 : RemovalDate=: ExchangePrices :
Even though the print shows Runner[0] - in vb.net it is listed as an array of runners. this works fine in vb.net:
RaceBook.runners(0).selectionId = 8972613
I just cannot get the data out no matter how I express it - my last resort is to parse the object - which I really do not want to do.
All help appreciated.
ballybeg


Reply With Quote
