基于教程here和here(ItemAdd方法),我实现了“对xyz文件夹中的每个新电子邮件执行某项操作”。
我想在不在线]时运行它。对于这种我无法访问Outlook服务器的典型公司情况,是否有解决方案?
我的后备解决方案不能在一夜之间关闭笔记本电脑。
Option Explicit
Private objNS As Outlook.NameSpace
Private WithEvents objNewMailItems As Outlook.Items
Private Sub Application_Startup()
Dim objMyInbox As Outlook.MAPIFolder
Set objNS = Application.GetNamespace("MAPI")
Set objMyInbox = objNS.Folders("[email protected]").Folders("Inbox")
Set objNewMailItems = objMyInbox.Items
Set objMyInbox = Nothing
End Sub
Private Sub objNewMailItems_ItemAdd(ByVal Item As Object)
'Ensure we are only working with e-mail items
If Item.Class <> olMail Then Exit Sub
'do something here with the incoming email
End Sub
我根据此处和此处的教程(ItemAdd方法)实现了“对xyz文件夹中的每个新电子邮件执行操作”。我希望它在不在线时运行。是否有解决此典型问题的方法...
我迟到了7个月,我想现在您的问题可能已经解决了。这是为像我这样的更多人而努力解决这个问题的。然而,它有一个简单的解决方案。我已经面对这种问题几天了。我唯一想做的事情不是实际上使宏在脱机模式下工作,而是在应用程序启动时处理未读电子邮件并将其标记为已读。我知道这并不是您一直在寻找的解决方案,但可能值得尝试。帮助您不必每天晚上都打开笔记本电脑:P