gpt4 book ai didi

excel - 昏暗如字典。编译错误: User-defined type not defined

转载 作者:行者123 更新时间:2023-12-01 22:00:38 24 4
gpt4 key购买 nike

您能帮忙解决这个问题吗?每当我运行这个宏时,它都会停止在:

Dim authResult As Dictionary

错误消息为:编译错误:用户定义类型未定义。

我之前没有使用过字典类型,我正在尝试重新使用示例宏中的这段代码。

该脚本的目的是使用 Excel 对网站进行剩余调用,以便我可以下载历史数据。我目前卡在登录部分。

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, i.e.
' 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 Scripting Runtime 的引用,如 @YowE3k 所说:

在 VBA 编辑器中:

工具 -> 引用

AddRef1

查找 Microsoft 脚本运行时

检查一下

点击确定

AddRef2

关于excel - 昏暗如字典。编译错误: User-defined type not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46128010/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com