Results 1 to 6 of 6

Application.OnTime method throwing some strange errors

Threaded View

  1. #1
    Registered User
    Join Date
    04-17-2013
    Location
    Columbia, MO
    MS-Off Ver
    Excel 2010
    Posts
    5

    Application.OnTime method throwing some strange errors

    Hi Everyone! I've been a fan of this site for a long time, but for some reason have never registered. I'm now here posing a problem that I'm having that I'm really hoping has an obvious solution I may have overlooked.

    Problem: OnTime method will immediately execute the indicated function without waiting for the specified time and, upon exiting the called function and returning to the function that called the OnTime method, an error is thrown. The specific error is very generic ("Run-time error '1004': Application-defined or object-defined error").

    How it's setup: I have a sub calling a very simple OnTime method and a function that is called from the OnTime method. Again, trying to keep this as simple as possible. Here is what it looks like:
    Public Sub test()
        Application.OnTime Now + TimeValue("00:00:10"), SampleFunction
    End Sub
    
    
    Private Function SampleFunction()
        MsgBox "This function is now being executed"
    End Function
    I execute the sub test(), it hits the OnTime method and immediately afterward the SampleFunction() is called. After that function exits the error is thrown. If I click "Debug" I'm taken directly back to the OnTime method. If I end, nothing further happens.

    Has anyone ever seen this before? I've used the OnTime method in the past and it's worked just fine - now it won't work at all . Any and all help is most appreciated! And please let me know if I can provide further details to assist. By the way, I'm using Office 2010 running on Windows 7 and this error is happening for me both at home and at work leading me to believe that I'm doing something terribly wrong...
    Last edited by cmosupport; 04-17-2013 at 09:33 PM. Reason: SOLVED!

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