VBA 程序暂停10秒后向下执行

   Dim time As String
    time = CStr(Now())
    方式一
    If Application.Wait(Now + TimeValue("0:00:10")) Then
       MsgBox time & Chr(10) & Now()
    End If
    方式二
    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 10
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    If Application.Wait(waitTime) Then
       MsgBox time & Chr(10) & Now()
    End If

你可能感兴趣的:(VBA)