+ Reply to Thread
Results 1 to 3 of 3

Excel 2016 - Web Query won't refresh before rest of code runs?

  1. #1
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Excel 2016 - Web Query won't refresh before rest of code runs?

    I have searched this issue before and have tried other solutions to no avail. I have a Web Query connection to bring in a table from a website. My macro intends to refresh this connection, and then append this information to another tab to create a historical list of information.

    If I go to the Data Connection properties it says my connection type is "OLE DB Query." The command type is SQL.

    I made sure to uncheck "Enable Background Refresh" on the table as well.

    From all those adjustments, it seems like my code should run, but it does not. The code runs and finishes before the query refreshes. Here is my code with some of those attempted adjustments:

    Please Login or Register  to view this content.
    I have also attempted wait or delay functions, but they just do the wait or delay and then once the time is up, then the workbook tries to refresh the connection and the code still finishes before the query refreshes.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Excel 2016 - Web Query won't refresh before rest of code runs?

    Try something like this, to force a "foreground" refresh:
    Please Login or Register  to view this content.

    (oh, and please update your profile to accurately reflect your Excel version!)
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Excel 2016 - Web Query won't refresh before rest of code runs?

    Quote Originally Posted by Olly View Post
    Try something like this, to force a "foreground" refresh:
    Please Login or Register  to view this content.

    (oh, and please update your profile to accurately reflect your Excel version!)
    Nailed it!

    Thanks for the help!

+ 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. Macro in Excel 2016 runs MUCH slower when ANOTHER spreadsheet is open?
    By Ed_Collins in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-17-2017, 06:59 PM
  2. Replies: 1
    Last Post: 07-07-2017, 03:11 PM
  3. Replies: 4
    Last Post: 06-01-2017, 11:45 PM
  4. Update Query Url: Excel 2016 Query
    By igoodable in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2017, 12:45 PM
  5. [SOLVED] Auto Refresh Pivot Tables Excel 2016 for Mac
    By sbothe in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-16-2017, 01:23 PM
  6. Replies: 1
    Last Post: 09-08-2015, 08:12 PM
  7. [SOLVED] Which runs first, Workbook_Open() or external query refresh?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-17-2005, 09:05 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