+ Reply to Thread
Results 1 to 9 of 9

Application.ontime query

  1. #1
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Application.ontime query

    Dear experts;
    I want to repeat a macro every 5 minute, but my code doesn't seem to work correctly.kindly give your idea.
    Please Login or Register  to view this content.
    Last edited by shaukat; 11-26-2011 at 02:11 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Application.ontime query

    Hi,

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Application.ontime query

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Please Login or Register  to view this content.
    hi Rchard,
    thanks for your prompt response, I tried it for 1 minute cycle.It ran for 1st sycle, 2nd cycle did not.moreover it only works when hit F5. the moment i hit F5 it will run rgiht after 1 minute. Not the minute hand of windows clock .Any Idea please?

    thanks

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Application.ontime query

    Since you must be able to stop this macro you need something more

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.



  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Application.ontime query

    perhaps this example will help you
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Application.ontime query

    Quote Originally Posted by snb View Post
    Since you must be able to stop this macro you need something more

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Hello SNB,
    thanks for your valuable input, some how the output of your macro is only one cycle.means runs only once. I have tried this in module1
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Application.ontime query

    Quote Originally Posted by nilem View Post
    perhaps this example will help you
    Hello Nilem,
    thanks for sharing .I still am trying to catch up this code, what is the meaning of this line.

    Application.OnTime NextTick, "UpdateClock"
    what i mean is why did you use "UpdateClock" inside the Sub UpdateClock()
    Last edited by shaukat; 11-25-2011 at 01:54 PM.

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Application.ontime query

    Pleas do not quote (see the forum rules)
    You shouldn't have changed anything in the code I provided.

    Put my code in a macromocule and start the macro Macro_new. That's all.
    You might add a messagebox to macro Macro_new.
    But please read the VBEditor's helpfiles on 'ontime' to analyse & understand the code.

  9. #9
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Application.ontime query

    thanks, I will not Qoute again.

+ 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