+ Reply to Thread
Results 1 to 19 of 19

ADODB Recordset Retrieving Data from a SharePoint Excel File

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    19

    ADODB Recordset Retrieving Data from a SharePoint Excel File

    I am trying to keep a database on sharepoint so multiple sites can update one database instead of collaborating them together every month for reporting. The macro file, which each site can house on their own computer, is using ADODB Recordsets to access the information from sharepoint. My connection to the sharepoint file seems to generate an error at the xlRS.Open line. The sharepoint file is password protected (I have tested the file unprotected and the same error is generated) and the error excel generates states: "Cannot connect to the SharePoint site, Try again later."

    Could someone please help resolve why my connection is failing when opening the recordset?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    Hi,

    Try changing

    xlSqlStr = "SELECT * " & _
    "FROM [CSR_Database$]"

    to

    xlSqlStr = "SELECT * FROM " & xlTable

    I am assuming xlTable holds the value of your DB Table..

    Let me know if that works..
    Last edited by NeedForExcel; 06-12-2015 at 12:08 AM.
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    11-15-2011
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    Yes, xlTable holds my DB Table's name, but changing the SQL string results in the same error.

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    Try this intead of xlRS.Open xlSqlStr, xlConn -

    Also, use the LockType & CursorType as desired.

    http://www.w3schools.com/asp/prop_rs_locktype.asp
    http://www.w3schools.com/asp/prop_rs_cursortype.asp
    Please Login or Register  to view this content.
    For the xlSqlStr Variable, try both the queries.. Yours and mine..

  5. #5
    Registered User
    Join Date
    11-15-2011
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    Already been through all of the different types and no such luck with any of them.

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    I'm pretty sure you can't use ADO over HTTP, you need to map the drive and use that ( Suspect that this will work) or take the file off sharepoint and put it on a network share, or just use a Sharepoint list rather than an Excel document

  7. #7
    Registered User
    Join Date
    11-15-2011
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    My company is requiring the use of SharePoint and I was using our network share during the initial programming (where everything was working fine) but international sites cannot have access to our network. I have mapped the drive but how do you access and update the data using VBA when the location is still web based? Could you please enlighten me on what a SharePoint list is and how to read and write to it with VBA?

  8. #8
    Registered User
    Join Date
    11-15-2011
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    Bump. This is very important and I would greatly appreciate any additional advice.

  9. #9
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    Have you google'd sharepoint lists? They're a pretty standard part of sharepoint - there's loads out there on them and you can query them with ADO.

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    Not sure, but should the name of the excel file not be left out of the site info?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  11. #11
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    @Arkadi, no, you can't ado to a file on a website

  12. #12
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    @ kyle, odd because I've seen numerous examples of sharepoint adodb connections though? but all that is provided for site is the path, and the id seems to be the reference to the actual file.
    However, having never done it myself, if you are sure then I 100% defer to your expertise, it was not my intent to contradict you

  13. #13
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    I'm happy to be wrong, would you mind pointing me in the direction of a working example?

    It's possible for Access on sharepoint and sharepoint lists - but I very much doubt files

  14. #14
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    Kyle, as I said before, it is unproven since I have never done it, and don't have access to any sharepoint lists, but this link for example, SUGGESTS to me that it can be done. That said, you'd know better, my well intended suggestion may be misleading.
    http://stackoverflow.com/questions/2...sts-with-adodb
    at first glance this one looks like a possibility too
    http://www.connectionstrings.com/sharepoint/


    EDIT: DOH, I now see the list/file distinction

  15. #15
    Registered User
    Join Date
    11-15-2011
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    I am going to be a few days responding back because I do not see where to create a sharepoint list on our sharepoint. I am hoping this is due to lack of permission and will get with one of our administrators.

    Arkadi I removed the filename but no luck. The same error message, "Cannot connect to the SharePoint Site, Try Again Later" occurs at the xlRS.Open line. As Kyle stated, a working example would be wonderful.

    EDIT: You beat me responding before I could get my wording.
    Last edited by Bradleybww; 06-18-2015 at 12:41 PM.

  16. #16
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    There isn't a working example because you can't do it, the links that Arkardi posted refer to sharepoint lists, not documents on sharepoint. Linking lists is dead easy, there's even a button on the list to do it.

    @arkadi, unfortunately, they're just lists as you've noticed

  17. #17
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    Sorry guys, didn't mean to mislead or confuse, my apologies.

  18. #18
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    No worries mate

  19. #19
    Registered User
    Join Date
    11-15-2011
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: ADODB Recordset Retrieving Data from a SharePoint Excel File

    For those wondering how to connect to a SharePoint List with Excel 2010 and have the capability for each data source to update the other, refer to this link: https://support.microsoft.com/en-us/kb/930006. This link does not answer my question regarding ADODB Recordsets but it gets the job done.

    You can then use ListObjects to resize the table and synchronize it with sharepoint.

    Please Login or Register  to view this content.

    If anyone knows how to get data from a SharePoint List using Excel ADODB Recordsets instead of using ListObjects, I would still greatly appreciate seeing an example.

+ 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. Replies: 0
    Last Post: 07-19-2012, 11:15 PM
  2. Refresh ADODB Recordset
    By oteixeira in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-01-2011, 04:12 AM
  3. writing ADODB recordset to excel sheet
    By bhavesh78 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2005, 12:55 PM
  4. VBA excel - problem with having clause in sql with adodb.connection/recordset
    By ukp9999 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-21-2005, 03:50 AM
  5. [SOLVED] Delete ADODB Recordset
    By Jim Thomlinson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-12-2005, 01:06 AM

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