Outlook) (AutoFormatRule 物件

代表 檢視 物件所使用的格式設定規則,用來決定如何格式化在該檢視中顯示的 Outlook 項目。

註解

使用 AutoFormatRules 集合的 Add 方法或 Insert 方法,為下列物件建立新的格式設定規則:

內建與自訂格式化規則

Microsoft Outlook 提供一組內建的格式設定規則,可以停用,但無法移除或重新排序。 自訂格式化規則是透過程式設計方式或由使用者動作所定義的,且不能移到內建的格式化規則之上或之間。 使用 Standard 屬性來判斷格式化規則是內建還是自訂。

套用格式化規則

會依照 AutoFormatRules 集合內含之格式化規則的順序,針對每個 Outlook 項目檢查及套用這些格式化規則。 使用 Enabled 屬性來啟用或停用格式化規則,使用 Filter 屬性定義 Outlook 項目必須符合才能由格式化規則格式化的條件,以及 使用 Font 屬性指定由格式化規則套用的格式。

範例

下列 Visual Basic for Applications (VBA) 範例列舉目前 TableView 物件的 AutoFormatRules 集合,並停用該集合所包含的任何自訂格式設定規則。

Private Sub DisableCustomAutoFormatRules() 
 
 Dim objTableView 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 
 
 
 
 ' Enumerate the AutoFormatRules collection for 
 
 ' the table view, disabling any custom formatting 
 
 ' rule defined for the view. 
 
 For Each objRule In objView.AutoFormatRules 
 
 If Not objRule.Standard Then 
 
 objRule.Enabled = False 
 
 End If 
 
 Next 
 
 
 
 ' Save and apply the table view. 
 
 objView.Save 
 
 objView.Apply 
 
 End If 
 
End Sub 
 

屬性

名稱
Application
Class
Enabled
Filter
Font
名稱
Parent
Session
Standard

另請參閱

Outlook 物件模型參考

支援和意見反應

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