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?
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
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.
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.
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 clickingbelow 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."
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks