VBA/Excel/Access/Word/Date Functions/TimeSerial

Материал из VB Эксперт
Перейти к: навигация, поиск

Scheduling a Macro to Run x Minutes in the Future

 
Sub ScheduleAnything()
    WaitHours = 0
    WaitMin = 2
    WaitSec = 30
    NameOfScheduledProc = "CaptureData"
    NextTime = time + TimeSerial(WaitHours, WaitMin, WaitSec)
    Application.OnTime EarliestTime:=NextTime, Procedure:=NameOfScheduledProc
End Sub



TimeSerial( returns AM

 
Sub timeDemo()
    Debug.Print TimeSerial(9, 0, 0)
End Sub



TimeSerial(hour, minute, second) returns a Variant/Date containing the time for the specified hour, minute, and second

 
Sub dateDemo14()
   Debug.Print TimeSerial(11, 12, 13)
End Sub