+ Reply to Thread
Results 1 to 3 of 3

application.ontime

  1. #1
    rick
    Guest

    application.ontime

    I have a simple routine that schedules several subroutines to run durin the
    day.
    Sub aaatest99()
    Application.OnTime TimeValue("07:59:50"), "aaaget800val"
    Application.OnTime TimeValue("08:59:50"), "aaaget900val"
    Application.OnTime TimeValue("09:59:50"), "aaaget1000val"
    end sub

    If I open excel, and run this routine. Then close excel, and re-open excel
    and re-run this routine... it appears that the subroutines are scheduled to
    run again, at the specified times. So that they will run twice, ie. the
    sceduled running of the subroutine was not cancelled when I closed excel.

    How exactly does Application.OnTime work?
    thanks, Rick
    [email protected]

  2. #2
    Tom Ogilvy
    Guest

    Re: application.ontime

    when you close excel, the scheduled activities are cancelled to the best of
    my knowledge. Perhaps your code is recursive.

    --
    Regards,
    Tom Ogilvy

    "rick" <[email protected]> wrote in message
    news:[email protected]...
    > I have a simple routine that schedules several subroutines to run durin

    the
    > day.
    > Sub aaatest99()
    > Application.OnTime TimeValue("07:59:50"), "aaaget800val"
    > Application.OnTime TimeValue("08:59:50"), "aaaget900val"
    > Application.OnTime TimeValue("09:59:50"), "aaaget1000val"
    > end sub
    >
    > If I open excel, and run this routine. Then close excel, and re-open

    excel
    > and re-run this routine... it appears that the subroutines are scheduled

    to
    > run again, at the specified times. So that they will run twice, ie. the
    > sceduled running of the subroutine was not cancelled when I closed excel.
    >
    > How exactly does Application.OnTime work?
    > thanks, Rick
    > [email protected]




  3. #3
    Bernie Deitrick
    Guest

    Re: application.ontime

    Rick,

    Cancel prior to scheduling:

    Sub aaatest99()
    On Error Resume NExt
    Application.OnTime TimeValue("07:59:50"), "aaaget800val", schedule:=False
    Application.OnTime TimeValue("08:59:50"), "aaaget900val", schedule:=False
    Application.OnTime TimeValue("09:59:50"), "aaaget1000val", schedule:=False
    Application.OnTime TimeValue("07:59:50"), "aaaget800val"
    Application.OnTime TimeValue("08:59:50"), "aaaget900val"
    Application.OnTime TimeValue("09:59:50"), "aaaget1000val"
    end sub

    HTH,
    Bernie
    MS Excel MVP


    "rick" <[email protected]> wrote in message
    news:[email protected]...
    >I have a simple routine that schedules several subroutines to run durin the
    > day.
    > Sub aaatest99()
    > Application.OnTime TimeValue("07:59:50"), "aaaget800val"
    > Application.OnTime TimeValue("08:59:50"), "aaaget900val"
    > Application.OnTime TimeValue("09:59:50"), "aaaget1000val"
    > end sub
    >
    > If I open excel, and run this routine. Then close excel, and re-open excel
    > and re-run this routine... it appears that the subroutines are scheduled to
    > run again, at the specified times. So that they will run twice, ie. the
    > sceduled running of the subroutine was not cancelled when I closed excel.
    >
    > How exactly does Application.OnTime work?
    > thanks, Rick
    > [email protected]




+ 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