Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
Am using Excel 2010. I am trying to run a macro on just one day only, anytime throughout the day starting from 09:30 onwards. But not run it if the day has changed. I have the following code in the Workbook_Open section: RunTimeFirst = DateSerial(2012, 12, 9) + TimeSerial(9, 30, 0) LastRun = RunFirstTime + 48600 Application.OnTime EarliestTime:=RunTimeFirst, _ Procedu="Birthday_Message", LatestTime:=LastRun, Schedule:=True The problem I'm having is understanding the LatestTime parameter. The help file states: "The latest time at which the procedure can be run. For example, if LatestTime is set to EarliestTime + 30 and Microsoft Excel is not in Ready, Copy, Cut, or Find mode at EarliestTime because another procedure is running, Microsoft Excel will wait 30 seconds for the first procedure to complete. If Microsoft Excel is not in Ready mode within 30 seconds, the procedure won’t be run. If this argument is omitted, Microsoft Excel will wait until the procedure can be run." Does LatestTime also stop the macro from running if LatestTime has passed, or just pause for time while Excel is not in ready mode? Is my LastRun declaration correct. Is the 48600 seconds like the help file says, or another value? (days?) When I run this now the macro will run everyday later than the RunTimeFirst date, and seems to ignore LastRun time. I know I can add an If statement to check the date: If Now DateSerial(2012, 12, 10) Then Exit Sub This will work, but I just wanted to know how LatestTime worked. Thanks in advance, edul |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find %ontime & SUMIF ontime ie: find matching sets within Range... | Excel Worksheet Functions | |||
OnTime | Excel Programming | |||
about ontime | Excel Programming | |||
OnTime...Please Help | Excel Programming | |||
OnTime Help | Excel Programming |