0
因此,我無法從API中獲取正確運行的方法。文檔說明方法有以下幾種:帶有API的Excel VBA問題
updateMethod(Object, String, Int)
對象是保存要更新的項目的工作表或工作簿。字符串是項目的名稱,而Int是什麼類型的更新將發生。
該方法已被實際使用Boolean使用,因爲它會返回True
如果更新False
如果不是:
wasUpdated = api.updateMethod(對象,字符串,整數)
所以我的代碼例子是:
Function TestUpdate()
Dim wasUpdated As Boolean
Dim Container As Object
Dim RangeName As String
Dim refreshType As Integer
Set Container = ThisWorkbook.Worksheets(1)
RangeName = "RangeTest"
refreshType = 0
wasUpdated = api.updateMethod(Container, RangeName, refreshType)
If wasUpdate = True Then
MsgBox "Updated"
Else
MsgBox "Failed"
End If
End Function
我一直在wasUpdate = ...
得到一個運行時錯誤424說「對象需要」。我沒有正確定義對象嗎?或者這是API本身的一個可能的問題,我需要聯繫該公司?
感謝
這是哪個API? –
API是專門爲「工作表對象」尋找的嗎?如果是這樣,請將'Dim Container As Object'更改爲'Dim Container as Worksheet' –
使用模塊頂部的Option Explicit。 您正在將函數調用的返回值存儲爲'wasUpdated',然後嘗試讀取'wasUpdate'。注意丟失的字母。 –