+ Reply to Thread
Results 1 to 2 of 2

VBA - Application.Ontime Cancel Fails to Method 'ONTIME' of Object 'Application'

  1. #1
    Registered User
    Join Date
    02-10-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    1

    Question VBA - Application.Ontime Cancel Fails to Method 'ONTIME' of Object 'Application'

    I am completely lost so any help will be greatly appreciated.

    I am attempting to cancel 2 scheduled event that are triggered when the Workbook is opened, and repeated using the Application.Ontime method.

    I know that to terminate the OnTime schedule loop, you must provide the exact time that it is scheduled to run and that having multiple Application.OnTime tasks requires multiple variables. This is why I have set two Public variables (Header of the document below Options Explicit):

    Please Login or Register  to view this content.
    The scheduler use these Variables and everything works properly as the code runs every minute.

    dTime's value is set inside the TaskTracker function to be:

    Please Login or Register  to view this content.
    dTime2's value is set inside the Autoclear function to be:

    Please Login or Register  to view this content.
    Despite all this, I get a Method 'ONTIME' of Object'Application' error message when attempting to run the function at the end of the module:

    Please Login or Register  to view this content.
    This is where I absolutely do not get what is going wrong. Triggering the Debug brings me to the OnTime section of each procedure cancel attempt.

    Below is the script that contains these elements. Hopefully this will give you guys some insight as to why these event can't be canceled. Please bare with me for this script is lengthy :P

    Please Login or Register  to view this content.

    Many Thanks,
    LordAzuRa

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: VBA - Application.Ontime Cancel Fails to Method 'ONTIME' of Object 'Application'

    Just a few things catch my eye - not sure if they are the fix or not...
    1) make those dTime variables Public. I don't think it will matter since they are in the same module, but it is good practice for this instance
    2) Any reason you are using Functions instead of Subs? I have always used Subs.
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Application.OnTime to run an objects method
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2014, 07:32 PM
  2. Struggling to get Application.OnTime working with an object
    By XmisterIS in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-29-2014, 10:55 AM
  3. Worksheets are not protected when workbook is closed via Application.OnTime Method
    By Shanthan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-21-2013, 12:06 AM
  4. application.ontime
    By msolari in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2013, 05:24 AM
  5. [SOLVED] Application.OnTime method throwing some strange errors
    By cmosupport in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-17-2013, 09:40 PM
  6. [SOLVED] Help with Application.OnTime (was Application.Wait Now)
    By Walter12 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-29-2012, 01:18 PM
  7. OnTime Method fails when Form displayed???
    By Ken Soenen in forum Excel General
    Replies: 3
    Last Post: 12-09-2005, 12:55 PM

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