+ Reply to Thread
Results 1 to 8 of 8

Code Improvement - SQL Statement Update SharePoint List

  1. #1
    Registered User
    Join Date
    02-22-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    9

    Code Improvement - SQL Statement Update SharePoint List

    Hello experts,

    I have the code below which updates some columns of SharePoint list, based on excel values, through its ID in a loop, however if I have hundreds of entries it take some time intil updates, so I would like to know with you can help with improvements in the code. It uses SQL statements in VBA to update the SharePoint List. The Activex must be enabled.

    Many thanks !

    Please Login or Register  to view this content.
    Last edited by teixeire; 06-28-2022 at 09:41 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Code Improvement - SQL Statement Update SharePoint List

    I'm not familiar with the SQL part of it, but I see two things that might help.

    Right after your DIM statements add "Application.Screenupdating = FALSE" to turn screen updates off so Excel doesn't waste it's time repainting the screen.
    Right after "tbl.refresh" add "Application.Screenupdating = TRUE" to turn screen updates back on.

    If you're doing your whole table, do you have to do it a row at a time? It would be much faster to do that whole table at once, but since I don't know the SQL side of it I can't help much with that.
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  3. #3
    Registered User
    Join Date
    02-22-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    9

    Re: Code Improvement - SQL Statement Update SharePoint List

    I found a solution, many thanks !

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,204

    Re: Code Improvement - SQL Statement Update SharePoint List

    Could you please state how you solved the problem? Others would also love to use it now and in the future.

    Artik

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Code Improvement - SQL Statement Update SharePoint List

    Agree, interested in your fix.

    And if your issue is solved you should update the thread by using the Thread Tools at the top of the page to mark it "Solved".

  6. #6
    Registered User
    Join Date
    02-22-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    9

    Re: Code Improvement - SQL Statement Update SharePoint List

    Okay, I did a sample table as below..
    I look for SQL statements and applied as below, doing a join between same table in different places, and update it in batch instead of row`s looping


    table example.png

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Code Improvement - SQL Statement Update SharePoint List

    Cool. How much difference in speed did you notice by making that change?

  8. #8
    Registered User
    Join Date
    02-22-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    9

    Re: Code Improvement - SQL Statement Update SharePoint List

    I asked end user to test in real scenario, but it seems to work much better than before

+ 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: 11-15-2021, 04:02 PM
  2. Replies: 0
    Last Post: 10-28-2020, 02:32 PM
  3. [SOLVED] Add items to Sharepoint list and update them
    By tanomandanga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2018, 03:09 AM
  4. Replies: 0
    Last Post: 10-08-2013, 10:54 AM
  5. Update SharePoint List from Excel using VBA
    By Novice_To_Excel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-03-2013, 03:03 AM
  6. update sharepoint list
    By sur in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-10-2012, 10:47 PM
  7. Update an existing SharePoint list within Excel using VBA
    By Snoopy2003 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2011, 07:20 PM

Tags for this Thread

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