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.
 
..font.color is not read only. Maybe you should post the code your trying to use
 
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
================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top