making toggle button in xl menu

  • Thread starter Thread starter tom taol
  • Start date Start date
T

tom taol

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, Before:=1)
With oMenu
.Caption = "test"
.Style = msoButtonIconAndCaptionBelow
.BeginGroup = True
End With
 
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("ControlName").State =
msoButtonDown
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top