+ Reply to Thread
Results 1 to 5 of 5

Userform Count down timer do not run as it should when run for second time

  1. #1
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Exclamation Userform Count down timer do not run as it should when run for second time

    Hi Forum Experts,

    I am facing this strange problem while designing an exam test form. I allow users to complete test in maximum 10 minutes so I coded a count down timer of 10 minute using Application.Ontime method. It works fine. However it continue execution even if userform is unloaded (when user submits the test or cancel). On running the form for second time, count down starts from point when earlier form was unloaded but now with double the speed of ticking.
    Can timer function (any function for that matter) be stopped from submit button click event?
    Please help in fixing this. Thanks in advance for all the help.
    Attached Files Attached Files
    Last edited by haripopuri; 11-03-2012 at 01:23 PM. Reason: Issue resolved

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Userform Count down timer do not run as it should when run for second time

    Somehow MaxTime needs t be set to zero.

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

  3. #3
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Userform Count down timer do not run as it should when run for second time

    Hi Dave,

    Thanks for the reply. Tried setting all the values to zero including MaxTime. Timer still runs in the background after unloading the form and with double the speed on next initiation.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Userform Count down timer do not run as it should when run for second time

    Hi hairpopuri

    Your code doesn't stop the Timer...try the code in the attached. Let me know of issues.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Userform Count down timer do not run as it should when run for second time

    Hi John,

    Thank you. Its working perfect. Meanwhile I also tried stopping timer with a Boolean variable flag and it worked too. Attached here as reference for any one who want another work around.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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