+ Reply to Thread
Results 1 to 5 of 5

Perform action on DATE and TIME

  1. #1
    Valued Forum Contributor ffffloyd's Avatar
    Join Date
    05-20-2008
    Location
    Perth, WA, Australia
    MS-Off Ver
    Office 365
    Posts
    249

    Perform action on DATE and TIME

    The Application.OnTime method allows you to schedule an action at a particular time of the day. It doesn't let you schedule a date though. What is the best method for scheduling an action at a particular time on a particular date?
    _______________
    Floyd Emerson
    Business Intelligence Consultant
    Perth, Western Australia

  2. #2
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Ontario Canada
    MS-Off Ver
    Excel 2010
    Posts
    124

    Re: Perform action on DATE and TIME

    You could put the macro in the Workbook_Open and use Windows Scheduler to open that workbook at a certain time.
    Alternatively, you could write a quick vbscript file to open the workbook and run the macro and schedule windows to run the vbscript.

  3. #3
    Valued Forum Contributor ffffloyd's Avatar
    Join Date
    05-20-2008
    Location
    Perth, WA, Australia
    MS-Off Ver
    Office 365
    Posts
    249

    Re: Perform action on DATE and TIME

    That's an interesting thought.

    I was thinking along the lines of the workbook already being open though (as in constantly) and just having something like OnTime fire on a particular date.

    If I have an action programmed for 23:59:59, say, tell it to fire the next action at 00:00:00, will it wait for the full second or will it say, "Oh, 00:00:00 passed 23 hours, 59 minutes and 59 seconds ago. I'd better execute this!" Easily resolved by introducing a pause of one second, I know, but that seems dreadfully inefficient if it is indeed unnecessary.

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Perform action on DATE and TIME

    Use Application.ontime to run a macro that compares Date() to the date you want it to run, if its true then call the macro you want run.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Perform action on DATE and TIME

    Please Login or Register  to view this content.

+ 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] How to perform action if time is between > and <...
    By JONBOY666 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-23-2013, 02:20 PM
  2. [SOLVED] Extract a time from a cell with date and time stamp and then perform calculations
    By Marcos Aristotelous in forum Excel General
    Replies: 3
    Last Post: 10-31-2012, 04:36 AM
  3. If this = this, then perform this action
    By 00Able in forum Excel General
    Replies: 8
    Last Post: 11-21-2010, 03:52 PM
  4. Perform action if filter is used
    By scifo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-13-2010, 07:15 AM
  5. How to perform action in all worksheets
    By Sethaholic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-11-2005, 02:44 PM

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