Simple Sharepoint list refresh macro from Excel 365 taking very long to refresh.

Aik Koon Wee 1 Reputation point
2021-02-03T04:05:32.077+00:00

Hi,
I'm using Excel 365 with a simple macro that gets triggered on workbook open event to refresh query connection for pulling data from Sharepoint list. Once the data is refreshed, another macro module is called to crunch these data. However, there is this problem of very slow crawling connection refresh with Sharepoint that sometimes ended up in 'Runtime error '1004'. An unexpected error has occurred.'. This error will happen at the refresh line in the macro.

If there is no error, the time taken to refresh can take between 5min to whopping > 10min. This data is from a sharepoint listing view which is already customized to filter out some rows within Sharepoint and the final rows of data that gets queried into the excel sheet is only 367 rows.

I hope to be able to understand what could be the possible causes so that i can reach out to my companies IT team to try to improve it. At the same time, if there are other reasons that i can resolved from my end, i would very much like to try it out.
Thank you.

63224-simple-list-query.jpg

Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

2 answers

Sort by: Most helpful
  1. Li Zhang_MSFT 1,566 Reputation points
    2021-02-04T09:29:42.43+00:00

    Hi @Aik Koon Wee ,

    Here are some tips to improve your VBA macro performance:

    1.Turn off everything but the essentials in VBA.

    2.Disable Office animations through system settings.

    3.Disable Office animations through registry settings.

    4.Remove unnecessary selects.

    5.Use the With statement to read object properties.

    6.Use ranges and arrays.

    For more information, please refer to:

    https://techcommunity.microsoft.com/t5/excel/9-quick-tips-to-improve-your-vba-macro-performance/m-p/173687


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. d1g1t4Lnrg 6 Reputation points
    2023-11-03T00:47:28.2666667+00:00

    If you are using a sharepoint list then use the export from there and you will have a query to pull your list of data.

    Just use a start up event to run the refresh on data, or you can setup this to refresh on open.

    Also use the workbook event to open your "ECT2sover"

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.