Outlook) (AutoFormatRule 对象

代表由 View 对象使用的格式规则,该规则用来确定如何设置该视图中显示的 Outlook 项目的格式。

备注

使用 AutoFormatRules 集合的 Add 方法或 Insert 方法可以为下列对象创建新的格式规则:

内置的格式设置规则和自定义的格式设置规则

Microsoft Outlook 提供了一组内置的格式规则,您可以禁用这些规则,但是不能删除它们,也不能对它们重新排序。 自定义的格式规则可以通过编程方式或用户操作来定义,您不能将它们移到内置的格式规则上方或之间。 使用 Standard 属性可以确定格式规则是内置规则还是自定义规则。

应用格式规则

格式设置规则将检查,并针对每个 Outlook 项目, AutoFormatRules 集合中包含的顺序应用。 使用 Enabled 属性可启用或禁用某一格式设置规则的 筛选器 属性来定义某个 Outlook 项目的格式设置规则设置格式时必须满足的条件和 字体 属性,以指定要应用的格式设置规则的格式。

示例

以下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
Enabled
Filter
Font
名称
Parent
Session
标准

另请参阅

Outlook 对象模型引用

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。