![]() |
Adding Controls in a toolbar?
How can I add controls to a toolbar, using VBA code?
|
Adding Controls in a toolbar?
This will add a new control to the worksheet menu bar:
Sub NewControl() Dim cmd As CommandBarButton Set cmd = Application.CommandBars("Worksheet Menu Bar"). _ Controls.Add With cmd .BeginGroup = True .Caption = "My New &Button" .Style = msoButtonCaption .BeginGroup = True .OnAction = "Insert Macro Name Here" End With OnExit: Set cmd = Nothing End Sub -- Kevin Backmann "joe" wrote: How can I add controls to a toolbar, using VBA code? |
Adding Controls in a toolbar?
I was a bit too fast with the mouse click.
The .Caption statement is the name of your command with the ampersand indicating which letter is the hot-key. And the OnAction statement is the name of the macro you want to execute when the user clicks the button. -- Kevin Backmann "joe" wrote: How can I add controls to a toolbar, using VBA code? |
All times are GMT +1. The time now is 05:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com