1. add two form controls and assign below procedures / macros to them.
Sub
AddMenuItem()
AddMenuItem()
Dim item As
CommandBarControl
CommandBarControl
Call
RemoveMenuItem
RemoveMenuItem
Set item =
CommandBars(1).Controls("Format").Controls.Add
CommandBars(1).Controls("Format").Controls.Add
item.Caption
= "&Run Macro1"
= "&Run Macro1"
item.OnAction
= "RunMacro1"
= "RunMacro1"
item.BeginGroup
= True
= True
End Sub
Sub
RemoveMenuItem()
RemoveMenuItem()
On Error
Resume Next
Resume Next
CommandBars(1).Controls("Format").Controls("&Run
Macro1").Delete
Macro1").Delete
End Sub
2. rename your macro procedure name to "RunMacro1" and click on AddMenuItem button.
you would see your shortcut under addins.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.