New_Alex
asked on
VBA, give colors to buttons
Hello guys.
I have 15 buttons on a form. Below it is a picture of my form with the buttons.
They are named like:
CommandButton1
CommandButton2
CommandButton3
....
....
...
CommandButton15
Respectively.....
I would like (with a vba macro) to give the 15 buttons the same colors as the highlight color options in word, like in the picture below
Any ideas of how I achieve this?
I have 15 buttons on a form. Below it is a picture of my form with the buttons.
They are named like:
CommandButton1
CommandButton2
CommandButton3
....
....
...
CommandButton15
Respectively.....
I would like (with a vba macro) to give the 15 buttons the same colors as the highlight color options in word, like in the picture below
Any ideas of how I achieve this?
I don't see BackColor as an option for CommandButton (which could just be me); maybe you'd be best off utilizing a different object type that has BackColor and specifying OnClick as well for the object.
ASKER
Hi Dagesi.
There is a BackColor option for CommandButton in the design Properties window.
It does not have to be a button. A select box could do the same.
How do I change the color of a CommandButton is the main question,,,
Any ideas?
There is a BackColor option for CommandButton in the design Properties window.
It does not have to be a button. A select box could do the same.
How do I change the color of a CommandButton is the main question,,,
Any ideas?
if you are supposed to use rectangular shape (similar to work as button), here goes the code
With ActiveWorkbook.Sheets(AShe et).Rectan gles.Add(2 80, 30, 160, 30)
.OnAction = "CODING"
.Caption = "MAIN MENU"
.Font.Size = 25
.Font.Underline = xlUnderlineStyleSingle
.Name = "CODING"
.Interior.Color = RGB(255, 255, 255)
.Border.Color = RGB(255, 255, 255)
End With
With ActiveWorkbook.Sheets(AShe
.OnAction = "CODING"
.Caption = "MAIN MENU"
.Font.Size = 25
.Font.Underline = xlUnderlineStyleSingle
.Name = "CODING"
.Interior.Color = RGB(255, 255, 255)
.Border.Color = RGB(255, 255, 255)
End With
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>New_Alex...
I think I see... I thought you were creating a form in another software (such as Access) that would be similar to Word's color pallette, not that you wanted to create one on a form apparently *in* Word.
I think I see... I thought you were creating a form in another software (such as Access) that would be similar to Word's color pallette, not that you wanted to create one on a form apparently *in* Word.
ASKER
Thanks GrahamSkan. This is the theory behind colors I needed to know. Then I may use .Jpg image as background with mouse click regions.
Thanks karthika_cts and dagesi as well for the value they added in my thread.
dagesi, that is right. I was looking for a word VBA solution within word.
Take care and
Love
Thanks karthika_cts and dagesi as well for the value they added in my thread.
dagesi, that is right. I was looking for a word VBA solution within word.
Take care and
Love