'Timer1.Interval = 10000 也没关系,仅仅会造成几秒钟的误差 Private Sub Timer1_Timer() Static Executed As Boolean If Executed And Time < "07:00:00" Then Executed = False ElseIf Not Executed And Time >= "07:00:00" Then MsgBox "起床啦!" '你自己改成你的要求 End If End Sub
订正: 'Timer1.Interval = 10000 也没关系,仅仅会造成几秒钟的误差 Private Sub Timer1_Timer() Static Executed As Boolean If Executed And Time < "07:00:00" Then Executed = False ElseIf Not Executed And Time >= "07:00:00" Then MsgBox "起床啦!" '你自己改成你的要求 Executed = True '此句忘了 End If End Sub
Private Sub Timer1_Timer()
Static Executed As Boolean
If Executed And Time < "07:00:00" Then
Executed = False
ElseIf Not Executed And Time >= "07:00:00" Then
MsgBox "起床啦!" '你自己改成你的要求
End If
End Sub
'Timer1.Interval = 10000 也没关系,仅仅会造成几秒钟的误差
Private Sub Timer1_Timer()
Static Executed As Boolean
If Executed And Time < "07:00:00" Then
Executed = False
ElseIf Not Executed And Time >= "07:00:00" Then
MsgBox "起床啦!" '你自己改成你的要求
Executed = True '此句忘了
End If
End Sub
那里要这么麻烦
不需要精确的话可以把时间格式化一下阿format(time,"hh:mm")
然后判断是不是=07:00就可以了这样的话Timer1.Interval = 10000设为半分钟以上以分钟以内就可以了
继不会出错也不会耗费资源
再有,就是注意timer的间隔不要太大