ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   checkbox for commandbar (https://www.excelbanter.com/excel-programming/415737-re-checkbox-commandbar.html)

Jim Thomlinson

checkbox for commandbar
 
Use a regular msoControlButton but use something like this for the on action...

Private Sub CheckButton()
Dim cbrMenu As CommandBar
Dim ctlCBarControl As CommandBarButton

Set cbrMenu = CommandBars("MyBar")
Set ctlCBarControl = cbrMenu.Controls("MyMenuName).Controls("MyControl" )

If ctlCBarControl.State = msoButtonDown Then
'some code
ctlCBarControl.State = msoButtonUp
Else
'somecode
ctlCBarControl.State = msoButtonDown
End If
Set cbrMenu = Nothing
Set ctlCBarControl = Nothing
End Sub

--
HTH...

Jim Thomlinson


"Redan" wrote:

Hello,

I would like to add control that would be like a checkbox in my commandbar
for excel 2002.

Is there any checkbox for msoControl or othere ways to do so ?

Thanks in advance for the help !!!



All times are GMT +1. The time now is 05:19 PM.

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