Search code examples
vbapowerpoint

Split Text in .TextRange


enter image description here

My objective is to split the List. Currently, I'm using Shapes().TextFrame.TextRange to read the text within the shape. We can use Mid() to split characters; however, I was wondering how I could go about splitting these lines instead as the characters in each line vary.

I'd like to only show the 2nd line (say) in the MsgBox. How do I proceed?

Thank you!


Solution

  • Let PPT do the heavy lifting for you:

    With ActiveWindow.Selection.ShapeRange(1)
        With .TextFrame.TextRange
            MsgBox .Paragraphs(2)
        End With
    End With