Is this a button added from the Forms toolbar? If so I don't think that you can change the backcolor. Is it on a worksheet? If so look at the .Caption property.
I don't think you can change the color, but one way to change the displayed text would be like this (change the sheet and button names as appropriate)...I am using the old style form control buttons and I want to be able to do things like change the text and color of the button depending on factors. It is easy enough to reference a controlbutton but how do I reference a form button? formbutton#?
Worksheets("Sheet3").Shapes("Button 1").OLEFormat.Object.Caption = "Hello"
I don't think you can change the color, but one way to change the displayed text would be like this (change the sheet and button names as appropriate)...
Code:Worksheets("Sheet3").Shapes("Button 1").OLEFormat.Object.Caption = "Hello"
You can change the Font color, but I don't believe there is anyway to get to the button's color itself (has something to do with how its drawn onto the sheet I think). Anyway, if changing the color, and making it bold to standout, is sufficient, then...Thanks Rick, works perfect. I still think there should be a way to change the color too, I mean if you can change the Caption propert.
With Worksheets("Sheet3").Shapes("Button 1").OLEFormat.Object
.Caption = "Hello There"
.Font.ColorIndex = 3
.Font.Bold = True
End With
You can change the Font color, but I don't believe there is anyway to get to the button's color itself (has something to do with how its drawn onto the sheet I think). Anyway, if changing the color, and making it bold to standout, is sufficient, then...
Code:With Worksheets("Sheet3").Shapes("Button 1").OLEFormat.Object .Caption = "Hello There" .Font.ColorIndex = 3 .Font.Bold = True End With
Once the color is changed, it is change... the color (and other properties) are not kept "alive" by the code, only changed by it. To put things back the way they were originally, run this code...Weird, I used this code but then I removed it and yet the font.colorindex keeps changing back to the color I had with the code. Hmmm
With Worksheets("Sheet3").Shapes("Button 1").OLEFormat.Object
.Caption = "Button 1"
.Font.ColorIndex = xlColorIndexAutomatic
.Font.Bold = False
End With