I have a simple function that creates an ADO connection to the workbook. I have used the code in countless spreadsheets, never with any problems. Recently, a client starting recieving an error message in the code below on the conn.open line when running the code on a spreadsheet stored in a location on the cloud. It does not happen to all spreadsheets stored in the cloud location, and it does not happen to the spreadsheet in question when running the code from a file on the user's machine.
This really has me stumped. Any ideas?
Thanks!
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
Bookmarks