Results 1 to 3 of 3

Web data query automatic refresh - specifying when background refresh has finished

Threaded View

  1. #1
    Registered User
    Join Date
    09-20-2013
    Location
    Office 2003
    MS-Off Ver
    Excel 2003
    Posts
    7

    Web data query automatic refresh - specifying when background refresh has finished

    I have the following code so it automatically refreshes all my external web data queries (background refresh) of my entire Workbook when I run this Macro every 2 minutes in a loop.

    Sub RunMacro()
    
    Dim wbc As WorkbookConnection
    Dim pc As PivotCache
    
    For Each wbc In ThisWorkbook.Connections
    wbc.Refresh
    Next wbc
    
    For Each pc In ThisWorkbook.PivotCaches
    pc.Refresh
    Next pc
       
        Application.OnTime Now + TimeValue("00:02:00"), "RunMacro"
       
    End Sub
    But how do I specify so that this Macro is run not every 2 minutes exactly, but run immediately after the background refresh has finished, in a loop (as in, imagine that refreshing any given webpage in Internet Explorer does not always take the exact amount of time every time I do so).
    Last edited by Jondar; 09-28-2013 at 07:09 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Run-Time error '1004' .refresh background query:= False
    By batador in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-24-2013, 06:00 AM
  2. Replies: 2
    Last Post: 02-22-2012, 08:13 AM
  3. Replies: 1
    Last Post: 02-21-2012, 05:40 PM
  4. Automatic query data refresh with template-- system or file setting?
    By Nick Douglas in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-23-2005, 12:05 PM
  5. [SOLVED] Query Refresh-Enable Automatic Refresh Dialogue Box
    By Terri in forum Excel General
    Replies: 0
    Last Post: 05-06-2005, 04:06 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