How to set the text color in powerpoint using automation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there. I'm trying to figure out if it's possible to set the color of text
that I add to a TextRange object using COM. It would seem that the best way
to do this would be to get a Font object from the the TextRange and access
the Color property but as far as I can tell, the Color property is read-only.
Can anyone confirm this or guide me in the right direction for a solution?
Thanks.
 
Hi there. I'm trying to figure out if it's possible to set the color of text
that I add to a TextRange object using COM. It would seem that the best way
to do this would be to get a Font object from the the TextRange and access
the Color property but as far as I can tell, the Color property is read-only.
Can anyone confirm this or guide me in the right direction for a solution?
Thanks.

Color is read-only but its various properties are not:

' Set the text to Red
TextRange.Font.Color.RGB = RGB(255,0,0)

' Set the text to a scheme color
TextRange.Font.Color.SchemeColor = [one of the scheme constants]
 
Thanks Steve. That's the answer I was looking for.

Steve Rindsberg said:
Hi there. I'm trying to figure out if it's possible to set the color of text
that I add to a TextRange object using COM. It would seem that the best way
to do this would be to get a Font object from the the TextRange and access
the Color property but as far as I can tell, the Color property is read-only.
Can anyone confirm this or guide me in the right direction for a solution?
Thanks.

Color is read-only but its various properties are not:

' Set the text to Red
TextRange.Font.Color.RGB = RGB(255,0,0)

' Set the text to a scheme color
TextRange.Font.Color.SchemeColor = [one of the scheme constants]


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
Back
Top