Name of the defualt shortcut commandbar.

  • Thread starter Thread starter Harry Tuttle
  • Start date Start date
H

Harry Tuttle

Hello I am trying to add my macro to the shortcut bar that popups when I
right click in a worksheet, however I don't know the name of that comand
bar, so I am unable to do so.

Does anyone know the name of this command bar, or where I could find
this info. I've tried google, and the VBA help files to no avail. I
don't know why this should be so hard to find.

-Thanks
 
It's called "Cell" as in:

Option Explicit
Sub testme()

Dim myCtrl As CommandBarControl
Dim myCB As CommandBar

Set myCB = Application.CommandBars("Cell")

Set myCtrl = myCB.Controls.Add(Type:=msoControlButton, temporary:=True)
With myCtrl
.BeginGroup = False
.Caption = "Your Caption Here"
.OnAction = "'" & ThisWorkbook.Name & "'!YourMacronameHere"
End With
End Sub
Sub yourmacronamehere()
MsgBox "Hi from here"
End Sub
 

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