View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Add items to context menu

That commandbar is called "Cell".

I saved this from a previous post:

This kind of thing might help:

Option Explicit
Sub auto_open()
With Application.CommandBars("cell")
On Error Resume Next
.Controls("DumpToFile").Delete
On Error GoTo 0

With .Controls.Add(Type:=msoControlButton, temporary:=True)
.BeginGroup = True
.Caption = "DumpToFile"
.OnAction = "'" & ThisWorkbook.Name & "'!yourmacronamehere"
End With
End With
End Sub
Sub auto_close()
With Application.CommandBars("cell")
On Error Resume Next
.Controls("DumpToFile").Delete
On Error GoTo 0
End With
End Sub
Sub yourmacronamehere()
MsgBox "hi from your macro!"
End Sub


Fred Jacobowitz wrote:

Excel 2003
How do I add items to the context menu that appears when I right click. I
would like to add items that will run a vba function just as I can with
keystrokes using the Application.Onkey function.
Thank you,
Fred Jacobowitz


--

Dave Peterson