我在下面的“ua”行收到以下错误。我正在尝试使用 enabler4excel 对象 [automationObject] 通过 VBA 将 Upsert 自动化到 Salesforce。
运行时错误'-2147467261 (80004003)
你调用的对象是空的
这是我的代码:
Dim addin As Office.COMAddIn
Dim automationObject As Object
For Each addin In Application.COMAddIns
If addin.Description = "Enabler for Excel" Then
Set automationObject = addin.Object
End If
Next addin
Dim error
result = automationObject.LogIn(Username,Password,"https://test.salesforce.com", error)
If result = False Then
MsgBox error
End
End If
Range("b1").Select
Selection.End(xlDown).Select
bot_acc = ActiveCell.Row
Dim ExternalId As String
ExternalId = Range("A1")
Dim ObjectName As String
ObjectName = "Account"
Dim AccUpArray(13, 9999) As Variant
For Column = 0 To 12
For Row = 0 To bot_acc - 2
AccUpArray(Column, Row) = Worksheets("Account").Range("A2").Offset(Row, Column)
Next Row
Next Column
ua = automationObject.UpsertData(AccUpArray, ObjectName, ExternalId, False, Nothing, error)
If Not error = Empty Then
MsgBox error
End
End If
我看不到你在哪里调暗
ua
但它是我假设的一个对象(即不是整数、字符串或布尔值......)这意味着你需要使用关键字set
看不到你在哪里变暗也可能意味着你没有使用
Option Explicit
。 You should be 。