+ Reply to Thread
Results 1 to 2 of 2

Excel 2019 Power Query update

Hybrid View

  1. #1
    Registered User
    Join Date
    12-18-2012
    Location
    Gladstone Manitoba Canada
    MS-Off Ver
    Excel 2019 and 2003
    Posts
    7

    Excel 2019 Power Query update

    Hi All,
    I need help to solve a data Power Query refresh problem.

    I coded the macro below to refresh 40 stock data sheets.

    Sub AutoRefreshStockData()
    Application.ScreenUpdating = False
    Dim X As Integer
    X = 0
    For X = 5 To Worksheets.Count  'Set sheets to refresh
    Sheets(X).Select ' Selects sheet to work with.
    Range("A7").ListObject.QueryTable.Refresh BackgroundQuery:=False ' Refresh sheet
    ProcessData ' Run data processing macro.
    Next X ' Starts all over again
    End Sub
    When I first run the macro, I get the following error message:

    Run-time error '1004':
    Initialization of the data source failed.
    Check the database server or contact your database administrator.
    Make sure the external database is available, and then try the
    operation again. If you see this message again, create a new data
    source to connect to the database.

    But I found that if I first manually refresh any one the 40 sheets , then the macro will run without error.

    All suggestions and help will be appreciated.
    Last edited by Jiggers; 10-19-2020 at 10:35 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,717

    Re: Excel 2019 Power Query update

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. Scheduling Power Query to Update File
    By wherdzik in forum Excel General
    Replies: 1
    Last Post: 03-28-2020, 09:02 PM
  2. [SOLVED] Power Query - excel formula translation into Power Query
    By afgi in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 02-19-2020, 03:38 AM
  3. Replies: 4
    Last Post: 02-17-2020, 06:03 AM
  4. [SOLVED] Power Query - update particular columns
    By afgi in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 02-16-2020, 06:41 PM
  5. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  6. Power Query Won't Update
    By Justair07 in forum Excel General
    Replies: 9
    Last Post: 09-29-2016, 04:46 PM
  7. automate power query update from new tab (office excel 2016)
    By ajnuna in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2016, 07:27 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