当尝试将responseText转换为用户定义的对象时,出现错误:Sub或Function not defined。
如何转换服务器在responseText中发送的元组?以前的一些文章建议使用CType进行转换,但VBA似乎找不到它,并给出了编译器错误。
这是我的代码,具有用户定义的类型,应在responseText中为其分配元组。谢谢
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