VBA ADODB Excel crashing on setting connection to nothing
JK2020
1
Reputation point Microsoft Employee
Hello,
Following a recent Office update, the below code started crashing Excel for me.
Sub testSPConnection()
Const spURL As String = "https://myDomainName.sharepoint.com/teams/myTeamSite/"
Const listID As String = "{5AB60906-62E5-418A-96A8-05A2E15V97X0}"
Dim cn As Object
Set cn = CreateObject("ADODB.Connection")
With cn
.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=1;RetrieveIds=Yes;DATABASE=" & spURL & ";LIST=" & listID & ";"
.Open
'do something
.Close
End With
Set cn = Nothing 'Excel crashes either here or, if this line is skipped, on End Sub
End Sub
Same when I run it in Word or Access.
I believe it might be to do with the .dll libraries, but not sure how to fix this.
Any ideas?
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft 365 and Office | SharePoint | For business | Windows
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Developer technologies | Visual Basic for Applications
Developer technologies | Visual Basic for Applications
An implementation of Visual Basic that is built into Microsoft products.
Sign in to answer