ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   making toggle button in xl menu (https://www.excelbanter.com/excel-programming/353209-making-toggle-button-xl-menu.html)

tom taol

making toggle button in xl menu
 


i need to method making the xl menu button of toggle button type using
macro(vba).
here is the code, it does not working.

Set oMenu = Application.CommandBars(1). _
Controls.Add(Type:=msoControlButtonToggle, Befo=1)
With oMenu
.Caption = "test"
.Style = msoButtonIconAndCaptionBelow
.BeginGroup = True
End With


*** Sent via Developersdex http://www.developersdex.com ***

Jim Thomlinson[_5_]

making toggle button in xl menu
 
Why not just use the state property of a regular button (msoControlButton).
Thsi will show the button as being either depressed or not... (msoButtonUp or
msoButtonDown)

Application.CommandBars("ToolBarName").Controls("C ontrolName").State =
msoButtonDown

--
HTH...

Jim Thomlinson


"tom taol" wrote:



i need to method making the xl menu button of toggle button type using
macro(vba).
here is the code, it does not working.

Set oMenu = Application.CommandBars(1). _
Controls.Add(Type:=msoControlButtonToggle, Befo=1)
With oMenu
.Caption = "test"
.Style = msoButtonIconAndCaptionBelow
.BeginGroup = True
End With


*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 08:33 AM.

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