VBA Excel writing to SharePoint ADO

JBakker

New Member
Joined
Jan 31, 2018
Messages
4
Hello all, I have a coding solution that worked successfully for a number of months but then stopped. I'm self-taught / Google/Youtube taught so you may have to dumb it down for me. The code takes a few fields from Excel and writes it to a SharePoint list.

The code still works fine for me and most of my co-workers (70+) but it doesn't work for a critical few (10). It is failing when opening the connection string. Since it is not failing for everyone, is there a setting that would effect this? The error received is :

"Run-time error '3706' Provider cannot be found. It may not be properly installed. "

Code:
Sub NewNIFdb()
    
    Dim con         As ADODB.Connection
    Dim rs          As ADODB.Recordset
    Dim SQL         As String
    
    Set con = New ADODB.Connection
    Set rs = New ADODB.Recordset
    SQL = "select * from [NIFdb] ;"
    
    
        With con
            .ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=2;RetrieveIds=Yes;DATABASE=http://connect.sharepoint.com/;LIST={6A33CBFF-87BF-4C7B-9D0C-B264E85ADE42};"
            .Open
        End With
        
        rs.Open SQL, con, adOpenDynamic, adLockOptimistic
        
        rs.AddNew
                        rs.Fields("Project Type") = Sheets("Requestor Phase 1").Range("b24")
                        rs.Fields("Project Name") = Sheets("Requestor Phase 1").Range("b25")
                        rs.Fields("MaterialCode") = Sheets("Master Data").Range("b6")
                        rs.Fields("Business Unit") = Sheets("Regular with or without Pouch").Range("fa2")
                 rs.Update
                 rs.Close
                 
        
        If CBool(rs.State And adStateOpen) = True Then rs.Close
        Set rs = Nothing
        If CBool(con.State And adStateOpen) = True Then con.Close
        Set con = Nothing
         
End Sub

Thanks for your help and patience
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Have the people who are having the problems had any changes/upgrades to their systems?
 
Upvote 0
Some are on Windows 10, most are on Windows 7 Ent. We all recently upgraded to Office 16. I'm currently running Win. 7 64 bit and Office '16 and it works for me. It doesn't work for others with the same combination.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top