在给定的时间内暂停Outlook

编程入门 行业动态 更新时间:2024-10-21 15:26:48
本文介绍了在给定的时间内暂停Outlook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在收到电子邮件10秒钟后运行Outlook代码.

I'm trying to run Outlook code 10 seconds after an email is received.

我尝试使用application.wait,但看来您无法在Outlook中执行此操作.

I tried using application.wait but it appears that you cannot do this with Outlook.

如何在给定的时间内暂停Outlook?

How do I pause Outlook for a given amount of time?

推荐答案

您可以创建一个模仿Application.Wait的Sub,类似于.

You can create a Sub that will mimic the Application.Wait, something like.

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

要调用此功能,可以使用Pause 3

To call this you could use Pause 3

更多推荐

在给定的时间内暂停Outlook

本文发布于:2023-11-27 07:23:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637117.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时间内   Outlook

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!