The code below adds a menu item Custom1 right before New.... How can I get the keyboard shortcut assigned to CodeCustom1 (via Application.OnKey
) to appear nicely right-aligned with Ctrl+N?
Sub menuItem_Create()
With CommandBars("Worksheet menu bar").Controls("File")
.Controls.Add(Type:=msoControlButton, Before:=1).Caption = "Custom1"
.Controls("Custom1").OnAction = "CodeCustom1"
End With
End Sub
Use the CommandbarButton's ShortcutText
property:
.Controls("Custom1").ShortcutText = "ctrl+W"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With