I'm getting the following error on the line 'ua' below. I'm trying to automate an Upsert to Salesforce through VBA using the enabler4excel object [automationObject].
Run-time error '-2147467261 (80004003)
Object reference not set to an instance of an object
Here is my code:
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