• Ontime Method (Excel )

    Author
    Topic
    #406802

    Hi all I need help,
    I want to run a procedure at a certain time of the day, I would like to load a userform automatically.

    I read the help files, but didn’t help that much, here’s what I have so far

    Application.ontime(“11:20:00”), Test, 30, schedule = False

    Question, where do I put this information in e.g….worksheet, workbook, module? any ideas?

    Viewing 1 reply thread
    Author
    Replies
    • #846205

      You must create a macro, i.e. a procedure in a module, and run that macro:

      Sub DoSomething()
      Application.OnTime TimeValue(“11:20”), “Test”
      End Sub

      Note that the time is specified by using TimeValue(“11:20”), I could also have used TimeSerial(11, 20, 0), and that the name of the procedure to be run is passed as a string.

      • #846213

        Thank you Hans,

        What triggers it to run the sub? Is it the Application?

        It didn’t work, I created a sub, and it didn’t run at the time I wanted.

        • #846221

          You must start the macro DoSomething (or whatever you called it). Excel then starts a timer (think of it as an egg timer) that goes off at the specified time.

          Note: Excel must remain open for this. If you quit Excel, the timer won’t run any more.

          • #846583

            I just wanted to make this post to end this,

            • #846611

              Does it do what you want now?

            • #846667

              Yes Thanks Hans,

              I just wanted to post that file so that someone else could use the example if they wanted.

              What I have learned is that Microsoft Help file are not too good for Newbies like myself.

            • #846668

              Yes Thanks Hans,

              I just wanted to post that file so that someone else could use the example if they wanted.

              What I have learned is that Microsoft Help file are not too good for Newbies like myself.

            • #846612

              Does it do what you want now?

          • #846584

            I just wanted to make this post to end this,

        • #846222

          You must start the macro DoSomething (or whatever you called it). Excel then starts a timer (think of it as an egg timer) that goes off at the specified time.

          Note: Excel must remain open for this. If you quit Excel, the timer won’t run any more.

      • #846214

        Thank you Hans,

        What triggers it to run the sub? Is it the Application?

        It didn’t work, I created a sub, and it didn’t run at the time I wanted.

    • #846206

      You must create a macro, i.e. a procedure in a module, and run that macro:

      Sub DoSomething()
      Application.OnTime TimeValue(“11:20”), “Test”
      End Sub

      Note that the time is specified by using TimeValue(“11:20”), I could also have used TimeSerial(11, 20, 0), and that the name of the procedure to be run is passed as a string.

    Viewing 1 reply thread
    Reply To: Ontime Method (Excel )

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: