Results 1 to 3 of 3

Thread: Loop thru selected paragraphs

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Loop thru selected paragraphs

    I want to format the current selection of paragraphs. I can format a specific paragraph:

    Application.ActiveWindow.Selection.ShapeRange.TextFrame2.TextRange.Paragraphs(1).ParagraphFormat.IndentLevel = 6
    and i can format all paragraphs in the textframe

    Application.ActiveWindow.Selection.ShapeRange.TextFrame2.TextRange.Paragraphs.ParagraphFormat.IndentLevel = 6
    but not just those selected.

  2. #2
    VBAX Master
    Feb 2007
    Doesn't this work?

    ActiveWindow.Selection.TextRange2.ParagraphFormat.IndentLevel = 6
    If you have non contiguous paragraphs selected then I don't know of any way to test for selection in a loop

    Maybe you could call e.g. BOLD from CommandBars.ExecuteMso("Bold") and then loop looking for bold text (or whatever)
    Last edited by John Wilson; 01-29-2021 at 09:16 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials

  3. #3
    Yes, it does, thanks! I knew i had to use TextFrame2 or TextRange2 to get above indent level 5 but found the syntax confounding.

    Thanks again.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts