편집

다음을 통해 공유


AutoFormatRule object (Outlook)

Represents a formatting rule used by a View object to determine how to format Outlook items displayed within that view.

Remarks

Use the Add method or the Insert method of the AutoFormatRules collection to create a new formatting rule for the following objects:

Built-In and Custom Formatting Rules

Microsoft Outlook provides a set of built-in formatting rules that can be disabled but cannot be removed or reordered. Custom formatting rules, defined either programmatically or by user action, cannot be moved above or between built-in formatting rules. Use the Standard property to determine whether a formatting rule is built-in or custom.

Applying Formatting Rules

Formatting rules are checked and applied against each Outlook item, in the order in which they are contained within the AutoFormatRules collection. Use the Enabled property to enable or disable a formatting rule, the Filter property to define the conditions an Outlook item must meet to be formatted by the formatting rule, and the Font property to specify the format to be applied by the formatting rule.

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 
 

Properties

Name
Application
Class
Enabled
Filter
Font
Name
Parent
Session
Standard

See also

Outlook Object Model Reference

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.