Môžete pomôcť s týmto problémom? Pri každom spustení tohto makra sa zastaví na adrese:
Dim authResult As Dictionary
Pri chybovom hlásení: Chyba kompilácie: Typ definovaný používateľom nie je definovaný.
Nepoužil som typ slovníka predtým a snažím sa tento kód znova použiť zo vzorového makra.
Cieľom tohto skriptu je použiť program Excel na spúšťanie hovorov na webových stránkach, aby som mohol prevziať historické údaje. Momentálne som prilepený na prihlasovacej sekcii.
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
Vopred ďakujem. Na zdravie, joe
odpovede:
6 pre odpoveď č. 1Pridajte odkaz na Microsoft Scripting Runtime ako @ YowE3k povedal:
V editore VBA:
Nástroje -> Referencie
Nájdite program Microsoft Runtime pre skriptovanie
Skontrolujte to
Kliknite na tlačidlo OK