+ Reply to Thread
Results 1 to 6 of 6

Real Time Clock Encountering Error Upon Userform Close

  1. #1
    Registered User
    Join Date
    03-21-2012
    Location
    Metro Manila, Phiippines
    MS-Off Ver
    Office 2007
    Posts
    77

    Real Time Clock Encountering Error Upon Userform Close

    Greetings!

    I made a userform for our daily work routine, I have added a real time ticking in the userform, upon opening the form, the clock ticks every second, but the problem is, when I close the form, an error is prompting and says "Method 'OnTime' of object '_Application' failed". Can anyone guess how to correct the code and add code so that when I close the form, the initialization of the clock stops too.

    here is my workbook

    Querier.xlsm
    "Consummatum Est"

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Real Time Clock Encountering Error Upon Userform Close

    Hi Stonesteel15,

    Remove the code for your Clock from the UserForm_Initialize event and place it in UserForm_Activate. That would include the reference to Module5 - GetTime.

    Also see This Thread: http://www.excelforum.com/excel-prog...e-and-tme.html
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Registered User
    Join Date
    03-21-2012
    Location
    Metro Manila, Phiippines
    MS-Off Ver
    Office 2007
    Posts
    77

    Re: Real Time Clock Encountering Error Upon Userform Close

    Thank you for the suggestion Sir Winon, I tried to do what you have said, and it was a success that I can close the userform without having a prompt of error, however, even if I can close the form, the clock still runs in the background, I wanted the clock to stop ticking when the userform was closed. can you suggest a code, I already tried the other codes inthe link given, but it only hides the form and does not stop the ticking of clock. I tried also the userform_queryclose, userform_deactivate but no avail.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-21-2012
    Location
    Metro Manila, Phiippines
    MS-Off Ver
    Office 2007
    Posts
    77

    Re: Real Time Clock Encountering Error Upon Userform Close

    I got it, the problem was solved. I put this code below the module of GetTime()

    Please Login or Register  to view this content.
    Then inserted to the buttons of confirmation and cancel

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Real Time Clock Encountering Error Upon Userform Close

    Hi Stonesteel15,

    That is unfair, I was working hard at it and came up with what you did before I could give you the solution. Congratulations, I am happy that you could solve the problem!

    What I have is very much what you did, i.e.

    Please Login or Register  to view this content.
    Good going!

  6. #6
    Registered User
    Join Date
    03-21-2012
    Location
    Metro Manila, Phiippines
    MS-Off Ver
    Office 2007
    Posts
    77

    Re: Real Time Clock Encountering Error Upon Userform Close

    ahaha, it looks exactly the same, I'm sorry Winon, I thought no one's gonna help me. But actually there's a lot of code I had to remove before the code works, and also I had to modify each of this code [Format(Now)] into [Strings.Format(Now())] to run, since it always prompting in the other pc an error of library or object not found etc etc.Anyways, I'm still waiting in the other thread I made. I am hoping you could help me on this one.

    http://www.excelforum.com/excel-prog...mmon-word.html

    Last edited by Stonesteel15; 03-28-2012 at 11:55 PM.

+ 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