Outlook) (AutoFormatRules 物件

代表檢視中 AutoFormatRule 物件的集合。

註解

使用AutoFormatRules集合的Add方法或Insert方法,為衍生自View物件的下列物件建立新的格式化規則:

AutoFormatRules 集合內含的 AutoFormatRule 物件,會依照其含在集合中的順序套用至每個 Outlook 項目。 唯有呼叫 AutoFormatRules 集合的 Save 方法,才能保留 AutoFormatRule 物件的變更。

範例

下列的 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 
 

方法

名稱
Add
Insert
項目
Remove
RemoveAll
Save

屬性

名稱
Application
Class
Count
Parent
Session

另請參閱

Outlook 物件模型參考

支援和意見反應

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