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

向前扩展选定内容,直至遇到具有另一种段落左右缩进量的文本为止。Extends the selection forward until text with different left or right paragraph indents is encountered.

语法Syntax

expression.expression. SelectCurrentIndent

_表达式_是必需的。expression Required. 表示 Selection 对象的变量。A variable that represents a Selection object.

示例Example

本示例跳转到活动文档中与活动文档的第一段的段落缩进量不同的第一个段落的开始。This example jumps to the beginning of the first paragraph in the document that has different indents than the first paragraph in the active document.

With Selection 
 .HomeKey Unit:=wdStory, Extend:=wdMove 
 .SelectCurrentIndent 
 .Collapse Direction:=wdCollapseEnd 
End With

本示例判断活动文档中的所有段落的段落左或右缩进量是否相同,然后在一个消息框显示判断结果。This example determines whether all the paragraphs in the active document are formatted with the same left and right indents and then displays a message box indicating the result.

With Selection 
 .HomeKey Unit:=wdStory, Extend:=wdMove 
 .SelectCurrentIndent 
 .Collapse Direction:=wdCollapseEnd 
End With 
If Selection.End = ActiveDocument.Content.End - 1 Then 
 MsgBox "All paragraphs share the same left " _ 
 & "and right indents." 
Else 
 MsgBox "Not all paragraphs share the same left " _ 
 & "and right indents." 
End If

另请参阅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.