【问题标题】:How to run code at startup, to mark all unread calendar items as read?如何在启动时运行代码,将所有未读日历项标记为已读?
【发布时间】:2014-12-28 01:01:31
【问题描述】:

我问如何在超级用户上手动mark all unread Calendar items in Outlook as read

我想在每次启动 Outlook 时自动执行此操作。似乎任何时候都有与 Outlook 同步的新日历条目,默认情况下该条目被标记为未读。

我用Outlook calendar unread property将VBA代码修改为mark all Outlook calendar items private

如何在启动期间以及为我的所有日​​历和子日历执行此操作?

Sub MakeAllRead()
Dim oFolder As Outlook.MAPIFolder
Dim oItems As Outlook.Items
Dim oAppt As Outlook.AppointmentItem

On Error Resume Next

Set oFolder = Application.Session.GetDefaultFolder(olFolderCalendar)
Set oItems = oFolder.Items
For Each oAppt In oItems
    If Err Then
        Err.Clear
    Else
        oAppt.UnRead = False
        oAppt.Save
    End If
Next
End Sub

【问题讨论】:

  • 已读/未读概念并不真正适用于日历项目。你到底想做什么?关闭提醒?
  • 我的第一个链接是指将所有日历项目标记为已读的手动步骤。问题是当新的日历项目从其他地方同步时,它在日历中显示为未读。我希望将所有日历项目标记为已读,这样它们就不会出现在文件夹视图中。我接受过对带有数字的文件夹进行操作的培训,但在日历中,这种类型的计数没有用,并且与我接受过对文件夹操作的培训方式背道而驰。

标签: vba outlook calendar


【解决方案1】:

要在启动时运行 MakeAllRead,请将其放入 ThisOutlookSession。

Private Sub Application_Startup() 

    MakeAllRead

End Sub 

我猜在代码运行之前日历项目不会在那里。然后,您将不得不继续手动运行代码。

根据它们在文件夹结构中的位置,参考这样的非默认日历。

Application.Session.Folders("日历名称")

Application.Session.Folders("其他邮箱名称").Folders("日历名称")

Application.Session.Folders("其他邮箱名称").Folders("收件箱").Folders("日历名称")

Application.Session.GetDefaultFolder(olFolderInbox).Folders("其他日历名称")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-26
    • 1970-01-01
    • 2018-06-07
    • 2022-01-16
    • 2019-10-18
    • 1970-01-01
    相关资源
    最近更新 更多