我怎么知道规则何时完成处理?

编程入门 行业动态 更新时间:2024-10-28 04:21:37
本文介绍了我怎么知道规则何时完成处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在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:

不幸的是,您会意识到在规则之后没有发生任何事件.可用事件NewMail和NewMailEx发生"[...],当新消息到达收件箱时并且在进行客户端规则处理之前." ( msdn.microsoft/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." (msdn.microsoft/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.NewMail或Application.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.

更多推荐

我怎么知道规则何时完成处理?

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

发布评论

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

>www.elefans.com

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