+ Reply to Thread
Results 1 to 4 of 4

ADODB.Connection Generating Error on File Located on Cloud

Hybrid View

  1. #1
    Registered User
    Join Date
    02-06-2013
    Location
    Pleasant Hill, CA
    MS-Off Ver
    Excel 365
    Posts
    25

    ADODB.Connection Generating Error on File Located on Cloud

    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

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: ADODB.Connection Generating Error on File Located on Cloud

    What's the error message?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-06-2013
    Location
    Pleasant Hill, CA
    MS-Off Ver
    Excel 365
    Posts
    25

    Re: ADODB.Connection Generating Error on File Located on Cloud

    Yes, the error message would have been helpful! It reads, "Format of the initialization string does not conform to the OLE DB specification."

    We have since figured out what was causing the issue: there was a dash (-) in the folder name where the file was stored. Once we removed the dash then the code ran without error. Odd that when the files were on a network drive some folders also contained dashes and there were no issues.

    Thought this info might be useful.

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: ADODB.Connection Generating Error on File Located on Cloud

    Thanks for sharing what was causing the issue.

    Please go to the thread tools drop down above your first post and mark the thread as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] ERROR: ADODB Spreadsheet Connection
    By Logit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-29-2016, 10:27 PM
  2. Connecting Excel to Microsoft access using ADODB.Connection RS.Filter error
    By Rachel3003 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2016, 06:34 AM
  3. [SOLVED] OBDC Connection to an external Excel file located on a Sharepoint webserver
    By Flipp in forum Access Tables & Databases
    Replies: 1
    Last Post: 01-17-2013, 04:37 AM
  4. ADODB.Connection : Sourcefile + if condition = error
    By vadius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-08-2013, 03:00 PM
  5. System Error in ADODB connection code
    By Jonsocks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2011, 12:33 PM
  6. Error with using adodb Connection and double quotes
    By JimCo in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 07-23-2010, 11:19 AM
  7. compile error... ADODB connection
    By ina in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2006, 12:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1