Help with menus

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

Hi there

I've written several macros for my workbook, and I want to access them via
menus. I can add them to the menus across the top of the screen, but what
I'd really like to do is add them to the menu that appears when you
right-click the mouse (e.g cut, copy, paste etc.)

anyone know how to do this?

Al
 
Al,

Add your button to the Cell Commandbar:

Sub ChangeCellDropDown()
With Application.CommandBars("Cell")
.Reset
.Enabled = True
With .Controls.Add(Type:=msoControlButton, before:=1)
.Caption = "My Macro"
.Style = msoButtonIconAndCaption
.FaceId = 59
.OnAction = "TryIt"
End With
End With
End Sub

HTH,
Bernie
Excel MVP
 
Al give this a try

Sub AddItemToContextMenu()
Dim cmdNew As CommandBarButton
Set cmdNew = CommandBars("cell").Controls.Add

With cmdNew
.Caption = "title of your macro"
.OnAction = "you macro here"
.BeginGroup = True
End With
End Sub

Use this to remove it
Sub RemoveContextMenuItem()
On Error Resume Next
CommandBars("cell").Controls("title of your macro").Delete
End Sub

--
Paul B
Always backup your data before trying something new
Using Excel 97 & 2000
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
Back
Top