+ Reply to Thread
Results 1 to 3 of 3

macro stops at midnight

  1. #1
    Registered User
    Join Date
    03-27-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    2

    macro stops at midnight

    Hi,
    I am using the following code to periodically pause a macro. The problem is, as the system clock runs through midnight, the macro stops working. Any idea of a way to be able to pause through midnight and continue to run later?
    Thanks!

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 03-27-2013 at 02:38 AM. Reason: Added CODE tags. as per forum rules. Don't forget!!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: macro stops at midnight

    You should read up on the web about the OnTime method. It lets you schedule a macro to run at a certain time in the future. Within the macro you scheduled to run should be additional code to reset the timer again using the OnTime method again. As long as you keep resetting the timer this way, it should run until whatever "test" you've built into your macro stops the process.

    The OnTime method lets you set the future time by a specific time, or "x seconds/minutes" in the future. So you could set the timer to run again in "Now + 10 seconds".
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: macro stops at midnight

    Maybe have a look at this.

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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