AutoFormatRule.Enabled Property (Outlook)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns or sets a Boolean value that indicates whether the formatting rule represented by the AutoFormatRule object is enabled. Read/write.

expression .Enabled

expression A variable that represents an AutoFormatRule object.

The following Visual Basic for Applications (VBA) example enumerates the AutoFormatRules collection for the current TableView object, disabling any custom formatting rule contained by the collection.

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 
 ' Save and apply the table view. 
 End If 
End Sub