Results 1 to 3 of 3

VBA macro code to refresh the excel data received from outer source every 5 seconds

Threaded View

  1. #1
    Registered User
    Join Date
    11-22-2014
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    VBA macro code to refresh the excel data received from outer source every 5 seconds

    Hi Everyone,

    Can anyone pls help me out to get the below mentioned VBA code working.

    Public RunWhen As Double
    Public Const cRunIntervalSeconds = 5
    Public Const cRunWhat = "The_Sub" 
    
    Sub StartTimer()
    RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
    Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, _
    schedule:=True
    End Sub 
    
    Sub The_Sub()
    MsgBox ""
    '
    ' your code here
    '
    StartTimer
    End Sub Sub StopTimer()
    On Error Resume Next
    Application.OnTime earliesttime:=RunWhen, _
    procedure:=cRunWhat, schedule:=False
    End Sub
    Actually with the help of this VBA code I am looking to refresh my data every 5 seconds which is taken from an external data source. The help will be appreciated.

    With Regards,
    RAJ.
    Last edited by rp301987; 11-28-2014 at 10:32 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Situational glitch causes macro failure. Need to write VBA code to correct.
    By ericwilder in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-10-2014, 04:49 PM
  2. Macro in Excel 2010 - can't open personal workbook with the VBA code to correct
    By Sparkmeister in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-12-2013, 03:34 PM
  3. Macro not functioning correctly, despite correct code
    By Bobbington in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2012, 07:53 AM
  4. Fix Needed for Code to Send Correct Data to Correct Sheets
    By swordswinger710 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-04-2012, 03:53 PM
  5. Can not create the correct code for Macro to paste to blank column
    By Elvis1960 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2011, 10:56 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