Ler*_*ler 4 outlook vba outlook-vba
我收到电子邮件后10秒钟尝试运行Outlook代码.
我尝试使用application.wait
但看起来你不能用Outlook做到这一点.
如何暂停Outlook一段时间?
你可以创建一个模仿它的Sub,Application.Wait
就像这样.
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
'For 64-Bit
'Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Sub Pause(intSeconds As Variant)
' Comments: Waits for a specified number of seconds
' Params : intSeconds Number of seconds to wait
' Source : Total Visual SourceBook
On Error GoTo PROC_ERR
Dim datTime As Date
datTime = DateAdd("s", intSeconds, Now)
Do
' Yield to other programs (better than using DoEvents which eats up all the CPU cycles)
Sleep 100
DoEvents
Loop Until Now >= datTime
PROC_EXIT:
Exit Sub
PROC_ERR:
MsgBox "Error: " & Err.Number & ". " & Err.Description, , "Pause Method"
Resume PROC_EXIT
End Sub
Run Code Online (Sandbox Code Playgroud)
要打电话给你,你可以使用 Pause 3
归档时间: |
|
查看次数: |
6189 次 |
最近记录: |