Hi Everyone!
I am trying to write a vba code to add data from excel to SharePoint List. However, I am receiving an error (snapshot for reference).
Error msg:
Run-time error '-2147467259 (80004005)
Could not find installable ISAM.
Can you please help me to understand and how to fix this issue?
Here is the vba code:
>>> use code - tags <<<
Code:
Option Explicit
Sub update2()
Dim cnt As ADODB.Connection
Dim rst As ADODB.Recordset
Dim mySQL As String
Set cnt = New ADODB.Connection
Set rst = New ADODB.Recordset
mySQL = "SELECT * FROM Test_List_ConnectGroup"
With cnt
.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=0;RetrieveIds=Yes;DATABASE=https://techmahindra.sharepoint.com/sites/BPSAnalyticsInfo/;LIST={6C3C4D38-98EB-4780-9CDA-1B0843EB6FFA};"
.Open
End With
rst.Open mySQL, cnt, adOpenDynamic, adLockOptimistic
rst.AddNew
rst!AgentName = Sheet1.Range("A2").Value
rst!RefNumber = Sheet1.Range("B2").Value
rst!EmpID = Sheet1.Range("C2").Value
rst!Address = Sheet1.Range("D2").Value
rst.Update
If CBool(rst.State And adStateOpen) = True Then rst.Close
Set rst = Nothing
If CBool(cnt.State And adStateOpen) = True Then cnt.Close
Set cnt = Nothing
MsgBox "Complete!"
End Sub
Thanks,
Abhinav
I am trying to write a vba code to add data from excel to SharePoint List. However, I am receiving an error (snapshot for reference).
Error msg:
Run-time error '-2147467259 (80004005)
Could not find installable ISAM.
Can you please help me to understand and how to fix this issue?
Here is the vba code:
>>> use code - tags <<<
Code:
Option Explicit
Sub update2()
Dim cnt As ADODB.Connection
Dim rst As ADODB.Recordset
Dim mySQL As String
Set cnt = New ADODB.Connection
Set rst = New ADODB.Recordset
mySQL = "SELECT * FROM Test_List_ConnectGroup"
With cnt
.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=0;RetrieveIds=Yes;DATABASE=https://techmahindra.sharepoint.com/sites/BPSAnalyticsInfo/;LIST={6C3C4D38-98EB-4780-9CDA-1B0843EB6FFA};"
.Open
End With
rst.Open mySQL, cnt, adOpenDynamic, adLockOptimistic
rst.AddNew
rst!AgentName = Sheet1.Range("A2").Value
rst!RefNumber = Sheet1.Range("B2").Value
rst!EmpID = Sheet1.Range("C2").Value
rst!Address = Sheet1.Range("D2").Value
rst.Update
If CBool(rst.State And adStateOpen) = True Then rst.Close
Set rst = Nothing
If CBool(cnt.State And adStateOpen) = True Then cnt.Close
Set cnt = Nothing
MsgBox "Complete!"
End Sub
Thanks,
Abhinav