VBA/Excel/Access/Word/Date Functions/TimeValue — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:48, 26 мая 2010
Содержание
Program an event for .m.:
Sub main()
Application.OnTime TimeValue("3:00:00 pm"), "DisplayAlarm"
End Sub
Sub DisplayAlarm()
Beep
MsgBox "Wake up. It"s time for your afternoon break!"
End Sub
Scheduling a Verbal Reminder
Sub ScheduleSpeak()
Application.OnTime EarliestTime:=TimeValue("9:14 AM"), Procedure:="RemindMe"
End Sub
Sub RemindMe()
Application.Speech.Speak Text:="meeting."
End Sub
TimerValue function returns time value
Sub TimeValueDemo()
MsgBox TimeValue("00:00:02")
End Sub
TimeValue("9:00") returns AM
Sub timeValueDemo()
Debug.Print timeValue("9:00")
End Sub
TimeValue(time) returns A Variant/Date containing the time for time
Sub dateDemo15()
Debug.Print timeValue(Now)
End Sub
To schedule an event relative to the current time - for example, 20 minutes from now
Sub Main()
Application.OnTime Now + TimeValue("00:20:00"), "DisplayAlarm"
End Sub
Sub DisplayAlarm()
Beep
MsgBox "Wake up. It"s time for your afternoon break!"
End Sub