views:

195

answers:

1

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 -

+2  A: 

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...

Pontus Gagge
with a bit of tinkering, I did get this to work by doing the copy(), then reading the rtf contents of the clipboard. Thanks -
OneNerd