ClearFormatting 方法 (Word)Selection.ClearFormatting method (Word)

清除所选内容的文本格式和段落格式。Removes text and paragraph formatting from a selection.

语法Syntax

表达式ClearFormattingexpression.ClearFormatting

_表达式_一个代表**Selection** 对象的变量。expression A variable that represents a Selection object.

示例Example

以下示例清除活动文档中的所有文本格式和段落格式。This example removes all text and paragraph formatting from the active document.

Sub ClrFmtg() 
 ActiveDocument.Select 
 Selection.ClearFormatting 
End Sub

以下示例清除活动文档的第二段至第四段中的所有文本格式和段落格式。This example removes all text and paragraph formatting from the second through the fourth paragraphs of the active document.

Sub ClrFmtg2() 
 ActiveDocument.Range(Start:=ActiveDocument.Paragraphs(2).Range.Start, _ 
 End:=ActiveDocument.Paragraphs(4).Range.End).Select 
 Selection.ClearFormatting 
End Sub

另请参阅See also

Selection 对象Selection Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.