Vba 仅显示选定类别的Outlook日历

Vba 仅显示选定类别的Outlook日历,vba,outlook,calendar,categories,Vba,Outlook,Calendar,Categories,是否可以让Outlook显示仅显示选定类别约会的月历 我可以将日历导出到表中,并使用一些Delphi代码在日历中显示项目,但直接在Outlook中执行会更好这应该是一个好的开始: Sub ConfigureDayViewFonts() Dim objView As CalendarView Dim CriteRia As String Dim SearchedCategory As String SearchedCategory = "SearchedCateg

是否可以让Outlook显示仅显示选定类别约会的月历


我可以将日历导出到表中,并使用一些Delphi代码在日历中显示项目,但直接在Outlook中执行会更好这应该是一个好的开始:

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

查看此答案及其建议请自行调整过滤器:

感谢您的输入-这帮助我正确设置过滤器,显示我想要的条目,然后打印出来。