Question

I use something like this to get the text from a shape inside PowerPoint:

s = ActiveWindow.Selection.SlideRange.Shapes("rec1").TextFrame.TextRange.Text

However, if the text has bold, underlined, resized (etc) text within the shape (meaning only certain words or phrases inside the shape), the .Text property converts it all to plain text.

I am looking to grab the stylized markup (perhaps RTF) of the shape.

I see that if I copy the text (highlight, right-click, then pick COPY), and then PASTE it into WordPad, it preserves everything. However, I dont see a .RTFText property (or anything similar) of the TextRange that I can access programatically.

Does anyone know how to do this programatically (via VBA I suppose)?

Thanks -

Was it helpful?

Solution

I think the only supported method is to automate clipboard access: do a VBA Copy and get the text from the clipboard yourself. Not elegant, and with side effects noticeable for the user, but...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top