我怎么知道规则何时完成处理? [英] How can I tell when Rules have finished processing?

查看:77
本文介绍了我怎么知道规则何时完成处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Outlook规则处理结束时,我试图找到一种方法来一次触发VBA子.我当前正在使用SyncEnd events,但是在首次启动Outlook时似乎无法正常工作(SyncEnd在规则在整个收件箱上运行之前触发,并且邮件所在的文件夹中尚不存在邮件项希望他们是.)

I'm trying to find a way to trigger a VBA sub once, at the end of Outlook Rule processing. I'm currently using SyncEnd events, but this doesn't seem to work properly when first starting Outlook (the SyncEnd fires before Rules are run on the entire inbox, and mail items are not yet present in the folders where my function expects them to be).

是否可以捕获规则处理完成"事件?

Is a way to capture a "rules processing completed" event?

推荐答案

所有Outlook事件都在VBE中有详细记录.只需按F2进入对象浏览器",然后选择Outlook库(在下拉菜单的顶部,然后查看所有可用事件.

All Outlook events are well documented within the VBE. Just press F2 to go into the Object Browser, then select the Outlook library (at the top in the drop-down menu, and then review all the available events.

(例如)以下是Outlook应用程序本身的所有可用事件:

Here are (for example) all available events for the Outlook application itself:

不幸的是,您会意识到在规则之后没有发生任何事件.可用事件NewMailNewMailEx发生"[...],当新消息到达收件箱时并且在进行客户端规则处理之前." ( https://msdn.microsoft.com/en-us/library /office/ff869202.aspx )

Unfortunately, you'll come to realize that there is no event which occurs after the rules. The available events NewMail and NewMailEx occur "[...] when new messages arrive in the Inbox and before client rule processing occurs." (https://msdn.microsoft.com/en-us/library/office/ff869202.aspx)

但是,正如@ Om3r指出的那样,您可以利用以下事实:VBA一次(一行一行)运行一个命令,然后等待命令完成(然后继续执行下一个命令).至少,除非您强制VBA以不同的方式处理命令,否则这就是VBA的工作方式.

Yet, as @Om3r pointed out, you can make use of the fact that VBA runs one command at a time (line by line) and waits for the command to complete (before moving on to the next one). At least, that's how the VBA works unless you force it to process commands differently.

因此,可以使用Application.NewMailApplication.NewMailEx事件执行规则,然后在处理完规则后附加要执行的VBA命令.

Hence, you can use the Application.NewMail or the Application.NewMailEx events to Execute the rules and then append the VBA commands you want to execute after the rules have been processed.

我当然希望这可以解决您的问题.让我知道您是否还有其他问题.

I sure hope this solves your problem. Let me know if you have any more questions.

这篇关于我怎么知道规则何时完成处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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