Outlook 等待几秒钟然后执行 [英] Outlook Wait a few seconds then execute

查看:68
本文介绍了Outlook 等待几秒钟然后执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Outlook 2010 中有一个简单的 VBA 代码,它可以自动打印任何传入的电子邮件.

I have a simple VBA code in Outlook 2010 which prints any incoming emails automatically.

此脚本设置为每次通过规则收到电子邮件时运行.

This script is set to run each time an email comes in through a rule.

代码如下:

Sub printradu(Item As Outlook.MailItem)
       MessageAndAttachmentProcessor Item, True
End Sub

我怎样才能让这个脚本等待 10 秒然后执行它.我需要这样的东西:

How can i make this script wait 10 seconds and then execute it. I need something like this:

Sub printradu(Item As Outlook.MailItem)
       'Wait 10 seconds then execute the code below:
       MessageAndAttachmentProcessor Item, True
End Sub

推荐答案

尝试:

Sub printradu(Item As Outlook.MailItem)
    'Wait 10 seconds then execute the code below:
    Application.Wait(Now + TimeValue("0:00:10"))
    MessageAndAttachmentProcessor Item, True
End Sub

或者:

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub printradu(Item As Outlook.MailItem)
    'Wait 10 seconds then execute the code below:
    Sleep(10000)
    MessageAndAttachmentProcessor Item, True
End Sub

或者:

Sub printradu(Item As Outlook.MailItem)
    'Wait 10 seconds then execute the code below:
    Threading.thread.sleep(10000)
    MessageAndAttachmentProcessor Item, True
End Sub

这篇关于Outlook 等待几秒钟然后执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆