I wrote a function to create a database connection that has worked well for years. A client recently moved the file that contains the function to OneDrive and now they receive the error in the subject line. Any ideas on how to resolve? Note that I tried to include the IMEX=1, as suggested by another post, but this just produced a different error.
VBA Code:
Function ConnectToSpreadsheet(CurBook As Workbook, conn As Connection)
ConnectToSpreadsheet = True
On Error Resume Next
'Create the ADODB connection object
Set conn = New ADODB.Connection
'Open connection
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & _
CurBook.FullName & "';Extended Properties='Excel 8.0;HDR=Yes'" ';IMEX=1'"
conn.Open
If Err.Number <> 0 Then
MsgBox "Could not connect to spreadsheet", vbOKOnly, "Connect To Spreadsheet"
Set conn = Nothing
ConnectToSpreadsheet = False
End If
End Function