昏暗字典。 编译错误:未定义用户定义的types

你能帮助解决这个问题吗? 每当我运行这个macros,它停在:

Dim authResult As Dictionary 

出现以下错误消息:编译错误:未定义用户定义的types。

我以前没有使用字典types,我试图从一个示例macros重新使用此代码。

这个脚本的目的是使用Excel来打电话到一个网站,以便我可以下载历史数据。 我目前卡在login部分。

 Sub Login() Dim userName As String Dim password As String Dim apiKey As String userName = "username" password = "password" apiKey = "key123" 'activityTextbox.Text = "" 'clearData Dim authResult As Dictionary Set authResult = restClient.authenticateAccount(userName, password, apiKey) If Not authResult Is Nothing Then 'appendActivity "Connected" ' Configure Excel to pull streaming updates as often as possible Application.RTD.ThrottleInterval = 0 ' Uncomment for real-time prices - this is very CPU intensive ' Buffer interval defaults to 500ms 'Application.WorksheetFunction.RTD "IG.api.excel.RTD.IGApiRTDServer", "", "bufferInterval", "0" ' Set manual refresh to true from very remote locations ' Application.WorksheetFunction.RTD "IG.api.excel.RTD.IGApiRTDServer", "", "manualRefresh", "true" ' This will require manually calling refresh to update lighstreamer subscriptions, ie ' Application.WorksheetFunction.RTD "IG.api.excel.RTD.IGApiRTDServer", "", "refresh" Dim maxPriceRequestsPerSecond As Double maxPriceRequestsPerSecond = 0 ' all available updates If restClient.streamingAuthentication(maxPriceRequestsPerSecond) Then m_loggedIn = True 'populateWatchlists 'populateAccounts 'manualStreamingRefresh 'Else ' appendActivity "Lightstreamer connection failure" End If Else MsgBox "Authentication failed" End If End Sub 

提前致谢。 干杯,乔

添加一个对Microsoft脚本运行时的引用@ YowE3k说:

在VBA编辑器中:

工具 – >参考

AddRef1

查找Microsoft脚本运行时

核实

点击确定

AddRef2