function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AmphitriteAmphitrite 

Enabler for Excel Insert vba error

I may have posted this in the wrong forum. Here is my issue related to the enabler for excel app from taralex.

I'm having an issue with the Enabler for Excel in completing an Insert via VBA. I'm getting the following run-time error on the line listed below.

LIne with error:   ip = automationObject.InsertData(ProdInArray, ObjectName, False, Nothing, error)
Error:   Object reference not set to an instance of an object.



Here is my complete VBA code [option explicit]

Sub InsertOpportunityLineItem()

  
    Dim addin As Office.COMAddIn
    Dim automationObject As Object
    Dim column As Integer
    Dim error As String
    Dim ip As Variant
    Dim ObjectName As String
    Dim ProdInArray(10, 9999) As Variant
    Dim Result As Boolean
    Dim Row As Integer
     
    ObjectName = "OpportunityLineItem"

     For Each addin In Application.COMAddIns
                     If addin.Description = "Enabler for Excel" Then
                                 Set automationObject = addin.Object
                   End If
     Next addin
 
                 'Login to environment
                 Result = automationObject.LogIn(Username2, Password2, "https://test.salesforce.com", error)
      
                 If Result = False Then
                    MsgBox error
                    End
                 End If
                 
                     
                'build insert array
                For column = 0 To 10
                      For Row = 0 To 19
                              ProdInArray(column, Row) = Worksheets(ObjectName).Range("B1").Offset(Row, column)
                      Next Row
                Next column
          
          
               set ip = automationObject.InsertData(ProdInArray, ObjectName, False, Nothing, error)
                If Not error = Empty Then
                      MsgBox error
                      End
                End If
                   
                   
                'write update results array
                For column = 0 To 1
                     For Row = 0 To 18
                           Worksheets(ObjectName).Range("R2").Offset(Row, column) = ip(column, Row)
                     Next Row
                Next column
        
   
    Result = automationObject.LogOut()