ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Syntax for changing font color in a Shapes object (https://www.excelbanter.com/excel-programming/376220-syntax-changing-font-color-shapes-object.html)

Ben

Syntax for changing font color in a Shapes object
 
ActiveSheet.Shapes("Rect2").Select
With Selection.Font
.ColorIndex = 1
End With

I use the code above to change the color of the text inside a rectangle and
it works fine but what is the correct syntax to use without having to select
the rectangle first.

Thank you



Thank you

Mike Fogleman

Syntax for changing font color in a Shapes object
 
With ActiveSheet.Shapes("Rect2").Font
.ColorIndex = 1
End With

Mike F

"Ben" wrote in message
...
ActiveSheet.Shapes("Rect2").Select
With Selection.Font
.ColorIndex = 1
End With

I use the code above to change the color of the text inside a rectangle
and
it works fine but what is the correct syntax to use without having to
select
the rectangle first.

Thank you



Thank you




Ben

Syntax for changing font color in a Shapes object
 
That's what I thought should work but it doesn't . It produces a run-time
error "Object doesn't support this propery or method"

"Mike Fogleman" wrote:

With ActiveSheet.Shapes("Rect2").Font
.ColorIndex = 1
End With

Mike F

"Ben" wrote in message
...
ActiveSheet.Shapes("Rect2").Select
With Selection.Font
.ColorIndex = 1
End With

I use the code above to change the color of the text inside a rectangle
and
it works fine but what is the correct syntax to use without having to
select
the rectangle first.

Thank you



Thank you





Dave Peterson

Syntax for changing font color in a Shapes object
 
ActiveSheet.Shapes("Rect2").TextFrame.Characters.F ont.ColorIndex = 1



Ben wrote:

ActiveSheet.Shapes("Rect2").Select
With Selection.Font
.ColorIndex = 1
End With

I use the code above to change the color of the text inside a rectangle and
it works fine but what is the correct syntax to use without having to select
the rectangle first.

Thank you

Thank you


--

Dave Peterson


All times are GMT +1. The time now is 12:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com