Help with menus

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
 
B

Bernie Deitrick

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
 
P

Paul B

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 **
 

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

Top