From: dsmith via OfficeKB.com on
I've written vba macro to insert a textbox into my powerpoint slide
presentation, but I want to emphasize a specific word or words in the text
box by changing its color to red. I only want the word to be red, not the
entire content of the textbox. Can this be done? Are there examples?
thnaks

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/powerpoint/201001/1

From: John Wilson john AT technologytrish.co DOT on
Maybe something like this:

Sub texty()
Dim otxR As TextRange
Set otxR = ActivePresentation.Slides(1).Shapes.AddTextbox _
(msoTextOrientationHorizontal, 10, 10, 200, 10).TextFrame.TextRange
With otxR
..Text = "This word is red"
..Words(2).Font.Color = vbRed
End With
End Sub

John
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html






"dsmith via OfficeKB.com" wrote:

> I've written vba macro to insert a textbox into my powerpoint slide
> presentation, but I want to emphasize a specific word or words in the text
> box by changing its color to red. I only want the word to be red, not the
> entire content of the textbox. Can this be done? Are there examples?
> thnaks
>
> --
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.aspx/powerpoint/201001/1
>
> .
>
From: Mark on
On Jan 18, 12:46 am, "dsmith via OfficeKB.com" <u56186(a)uwe> wrote:
> I've written vba macro to insert a textbox into my powerpoint slide
> presentation, but I want to emphasize a specific word or words in the text
> box by changing its color to red. I only want the word to be red, not the
> entire content of the textbox. Can this be done? Are there examples?
> thnaks
>
> --
> Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/powerpoint/201001/1

Try this, I believe it should do what you want:

Private Function colorText(ByRef txtrng As textRange, ByVal
SearchString As String, Optional ByVal textColor As RGBColor = vbRed)
Dim foundText As textRange
Set foundText = txtrng.Find(FindWhat:=SearchString)
Do While Not (foundText Is Nothing)
With foundText
.Font.Color.RGB = textColor
End With
Loop
End Function
From: David Marcovitz on
On 1/18/10 12:46 AM, in article a247bd7ce9b91(a)uwe, "dsmith via OfficeKB.com"
<u56186(a)uwe> wrote:

> I've written vba macro to insert a textbox into my powerpoint slide
> presentation, but I want to emphasize a specific word or words in the text
> box by changing its color to red. I only want the word to be red, not the
> entire content of the textbox. Can this be done? Are there examples?
> thnaks

Example 6.8 on my site changes the color of some text in a text box. See
Examples by Chapter and Chapter 6 on http://www.PowerfulPowerPoint.com/

--David
--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland