SyncEnd事件宏无法可靠地工作 [英] SyncEnd event macro not working reliably
问题描述
在Outlook启动时运行收件箱清理宏时出现问题。
I am having problems running an inbox cleanup macro when Outlook starts up.
以下VBA宏通常在Outlook 2010中可靠运行,并在文件夹清理后清理收件箱同步。它会偶尔在收件箱同步之前运行,但通常会按预期运行。
The following VBA macro normally works reliably in Outlook 2010 and cleans up the Inbox after folders have been synced. It will occasionally run before the Inbox is synced but normally runs as expected.
在Outlook 2016中使用相同的宏,SyncEnd宏总是在文件夹同步之前运行,看起来很快当启动宏完成时。
Using the same macro with Outlook 2016 the SyncEnd macro always runs before folders are synced, seemingly as soon as the startup macro completes.
两种情况下的邮件服务器都是outlook.com。两个Outlook客户端都连接到同一个帐户(不是同时),并且都使用缓存Exchange模式配置为Exchange。
The mail server in both cases is outlook.com. Both outlook clients connect to the same account (not at the same time) and both are configured as Exchange using Cached Exchange mode.
除了手动运行它之外,确保最佳方法是什么文件夹同步后宏运行?
Other than running it manually what is the best way to ensure the macro runs after folders are synced?
以下内容安装于ThisOutlookSession
The following is installed in ThisOutlookSession
Dim WithEvents mySync As Outlook.SyncObject
Private Sub Application_Startup()
Set mySync = Application.Session.SyncObjects.Item(1)
mySync.Start
End Sub
Private Sub mySync_SyncEnd()
MsgBox "Synchronization is complete."
End Sub
推荐答案
抱歉,这不是VB / VBA论坛。
Sorry but this is not a VB/VBA forum.
在Outlook开发者论坛中发帖寻求帮助。
Post in the Outlook Developers forum for assistance.
这篇关于SyncEnd事件宏无法可靠地工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!