How to convert VBA responseText to a user-defined tuple?

176 views Asked by At

When trying to convert responseText to a user-defined object, I get the error: Sub or Function not defined.

How do I convert a tuple sent by the server in responseText? Some previous posts suggested of casting using CType but VBA can't seem to find it and gives a compiler error.

Here's my code with the user-defined type that should be assigned the tuple in responseText. Thanks

Type DblStrTuple
    StrikePrice As Double
    Volatility As String
End Type

Function GetCorrectPutStrikeAndVolatility(ByVal StockTicker, ByVal StrikePrice, ByVal TargetDate) As DblStrTuple

    Dim XmlHttp As Object
    Set XmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
    Url = "http://192.168.1.9:5005/options/get_strike_price_and_volatiitlity?"

    FinalUrl = Url & StockTicker & "+" & StrikePrice & "+" & TargetDate

    XmlHttp.Open "GET", FinalUrl, False

    XmlHttp.send

    CorrectCallOptionStrikePrice = DblStrTuple(XmlHttp.responseText)

End Function
0

There are 0 answers