會傳回或設定 String 值,代表用於自訂格式化規則的篩選。 讀取/寫入。
語法
expression。 Filter
詞 一個代表 AutoFormatRule 物件的變數。
註解
此屬性值為「DAV 搜尋及尋找」(DASL) 字串,代表自訂格式化規則的目前篩選。 如需使用 DASL 篩選由格式化規則格式化後之項目的詳細資訊,請參閱篩選項目。 如果此屬性設定為空白字串,則會將自訂格式化規則套用至檢視顯示的所有項目。
注意事項
此屬性會回傳一個空字串,代表標準格式規則 (一個 AutoFormatRule 物件,該物件的 Standard 屬性值設為 True) 。 如果嘗試對此屬性指派標準格式化規則的值,便會發生錯誤。
範例
以下 Visual Basic for Applications (VBA) 範例,利用 Explorer 物件的 CurrentView 屬性取得一個檢視物件,然後建立一個名為「Handoff Messages」的新自動格式規則。AutoFormatRule 物件的 Filter 屬性設定為格式規則適用於任何主旨屬性值以「HANDOFF」開頭的訊息。 範例接著設定 AutoFormatRule 物件的字型物件屬性,使得該格式規則所適用的訊息以藍色、粗體、8 點的 Courier 新文字顯示。
Private Sub FormatHandoffMessages()
Dim objView As TableView
Dim objRule As AutoFormatRule
' Check if the current view is a table view.
If Application.ActiveExplorer.CurrentView.ViewType = olTableView Then
' Obtain a TableView object reference to the current view.
Set objView = Application.ActiveExplorer.CurrentView
' Create a new rule that displays any message with a
' subject line that starts with "HANDOFF" in
' blue, bold, 8 point Courier New text.
Set objRule = objView.AutoFormatRules.Add("Handoff Messages")
With objRule
.Filter = """http://schemas.microsoft.com/mapi/proptag/0x0037001f""" & _
" CI_STARTSWITH 'HANDOFF'"
With .Font
.Name = "Courier New"
.Size = "8"
.Bold = True
.Color = olColorBlue
End With
End With
' Save and apply the table view.
objView.Save
objView.Apply
End If
End Sub
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。