Gopra


Need to enable/disable a button if if choose shapes, text boxes then button fill color should be enable, if i unselect then it would be disable





Re: Enable/disable specific button in command bar

ke wenzel


Hi Gopra,

I'm not sure about the context of your question, but you can make a control appear or disappear by setting its Visible property to True or False. This property change can be triggered by the On Change event for another control.

Again, I'm unsure about the specifics of you question, but assume chkAllowFill is a check box and btnFillColor is a button (In MS Excel or MS Access). The following code will make btnFillColor appear or dissappear when the chkAllowFill box is checked or unchecked:

Code Block

Private Sub chkAllowFill_Change()

btnFillColor.Visible = chkAllowFill.Value

End Sub


Hope that helps,
KW





Re: Enable/disable specific button in command bar

Gopra

ke wenzel

Thanks for the reply! Sorry for that i am not specific on my questions . Once i again i will try. for eg. if i want to fill a color for a shape then i need to select the shape and then give fill color. If i am not select the shape then that fill color wont be available to select rite. like that i need to do.

I hope that i explained lit bit clearly







Re: Enable/disable specific button in command bar

Mezhick

Hi!

Shapes have no events. So you cannot use _GotFocus or LostFocus events and attached procedures.






Re: Enable/disable specific button in command bar

bi-lya

Hi!

See a simple example. Before run ShapeShow (you may use WorkBook_Open), after click Shape

Code Block

Sub ShapeShow()
Worksheets(1).Shapes(1).OnAction = "ShapeClick"
End Sub

Sub ShapeClick()
MsgBox Worksheets(1).Shapes(1).Name
End Sub

Create a Public variable instead "MsgBox ..." and use it





Re: Enable/disable specific button in command bar

Gopra

Thanks for the answer. I want to reinvent the process what the MS is doing for eg. if u select a text box in powerpoint then only the fill color is enble without valid selection it won't be enable in other words if and only if the shapes are selected the fill color is enbled otherwise its greyed out. so i have my own specific color while selecting a shape or text box only it will enable otherwise it will be greyed out.

Is it possible to do






Re: Enable/disable specific button in command bar

priyaenc

How to add color to command button




Re: Enable/disable specific button in command bar

Andy Pope

You can not control the color of the buttons on a command bar.

The best you could do is use a picture that has a background colour.