Outlook) (AutoFormatRule.Filter 屬性

會傳回或設定 String 值,代表用於自訂格式化規則的篩選。 讀取/寫入。

語法

expression。 Filter

運算式 代表 AutoFormatRule 物件的變數。

註解

此屬性值為「DAV 搜尋及尋找」(DASL) 字串,代表自訂格式化規則的目前篩選。 如需使用 DASL 篩選由格式化規則格式化後之項目的詳細資訊,請參閱篩選項目。 如果此屬性設定為空白字串,則會將自訂格式化規則套用至檢視顯示的所有項目。

注意事項

此屬性會針對 (Standard 屬性值設為 True) 的 AutoFormatRule 物件,傳回標準格式化規則的空字串。 如果嘗試對此屬性指派標準格式化規則的值,便會發生錯誤。

範例

下列 Visual Basic for Applications (VBA) 範例使用 Explorer 物件的 CurrentView 屬性取得 View 物件,然後建立名為 “Handoff Messages” 的新 AutoFormatRule。AutoFormatRule 物件的 Filter 屬性已設定,可將格式化規則套用至主旨屬性值開頭為 “HANDOFF” 的任何郵件。 然後,範例會設定 AutoFormatRule 物件的 Font 物件屬性,讓套用格式化規則的郵件以藍色、粗體、8 點快遞新文字顯示。

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

另請參閱

AutoFormatRule 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。