vba 倒计时到零之后自动停止并提前一分钟提醒用户
建议用定时器,代码是网上搜的,我现在就在用。
Declare Function SetTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long) As Long '###########以上有两个Api为SetTimer及KillTimer############
Private TimerID As Long '########上面是一个定时的ID便于你管理多个定时器##############
'*****************************************
Sub TimerProc(ByVal hWnd As Long, ByVal nMsg As Long, _
ByVal nTimerid As Long, ByVal dwTime As Long)
On Error Resume Next '#######注意上方的错误处理#########
ThisWorkbook.Sheets("A").Cells(1, 14).Value = Now()
If Minute(Now) = 30 And Second(Now) = 0 Then
Call AA
ElseIf Minute(Now) = 0 And Second(Now) = 0 Then
Call AAA
Else
End If
End Sub
多重随机标签