Log in

View Full Version : [SOLVED:] Changing the text colour in a named shape



isabelle r
11-10-2016, 06:59 AM
Hello,

Sorry in advance for asking such a stupid question. If PPT still had a macro recorder, I would have worked this out for myself a long time ago. I spent an hour on Google searching, but nothing useful. :banghead:

All I need is this: I have a shape named "comments" containing text. I need a macro to select the "comments" shape in the current slide, and to change the colour of all the text it contains to RGB 197,90,17.

That is all :)

Thank you.

-Isa

John Wilson
11-10-2016, 07:41 AM
The old recorder would not have given you sensible code for this.

The code would be different in edit view and in show view and you don't say which it is. The code below is for EDIT view and is for version 2007 onwards


Sub ChangeColor()
Dim osld As Slide
Dim oshp As Shape
Set osld = ActiveWindow.Selection.SlideRange(1) 'current slide
Set oshp = osld.Shapes("comments") ' make sure you get the name correct
oshp.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(197, 90, 17)
End Sub

isabelle r
11-10-2016, 08:33 AM
Works perfectly :) Thank you.