SelectCurrentIndent Method

Microsoft Word Visual Basic

SelectCurrentIndent Method

       

Extends the selection forward until text with different left or right paragraph indents is encountered.

expression.SelectCurrentIndent

expression   Required. An expression that returns 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