Adding Command Buttons
This code shows you how to add a command button to an existing Menu.
Public Sub BET_AddCommandToTools()
Dim objCommand As CommandBarPopup
Dim objButton As CommandBarButton
Set objCommand = Application.CommandBars("Worksheet Menu Bar").Controls("Tools")
Set objButton = objCommand.Controls("New Command") ????
Set objButton = objCommand.Controls.Add(Type:=msoControlButton, Before:=3)
objButton.Caption = "New Command"
objButton.OnAction = "YourMacroName"
End Sub
Public Sub YourMacroName()
Your code
End Sub
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext