仅显示选定类别

时间:2015-12-14 09:28:44

标签: vba calendar outlook categories outlook-vba

以任何方式让Outlook显示仅显示所选类别约会的月度日历。

我可以将日历导出到表格中,并使用一些Delphi代码在日历中显示该项目,但直接在Outlook中显示它会更好

1 个答案:

答案 0 :(得分:1)

这应该是一个好的开始:

Sub ConfigureDayViewFonts()
    Dim objView As CalendarView
    Dim CriteRia As String
    Dim SearchedCategory As String

    SearchedCategory = "SearchedCategory"

    CriteRia = "@SQL=" & Chr(34) _
        & "urn:schemas-microsoft-com:office:office#Keywords" _
        & Chr(34) & " ci_startswith '" & SearchedCategory & "'"

    ' Check if the current view is a calendar view.
    If Application.ActiveExplorer.CurrentView.ViewType = _
        olCalendarView Then

        ' Obtain a CalendarView object reference for the
        ' current calendar view.
        Set objView = _
            Application.ActiveExplorer.CurrentView

        With objView
            ' Set the calendar view to show a
            ' single day.
            .CalendarViewMode = olCalendarViewMonth
            .Filter = CriteRia

            ' Save the calendar view.
            '.Save
        End With
    End If
End Sub

请参阅此答案及其建议,请自行调整过滤器:https://stackoverflow.com/a/14152882/4628637