共用方式為


AutoFormatRule.Enabled Property (Outlook)

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

Version Information

Version Added: Outlook 2007

Syntax

expression .Enabled

expression A variable that represents an AutoFormatRule object.

Example

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

See Also

Concepts

AutoFormatRule Object Members

AutoFormatRule Object