Displaying A custom menu as a popup menu
hi,
I've found this code from excel vba help:
This example adds a new menu item to the shortcut menu for cells
B1:B10.
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
Cancel As Boolean)
Dim icbc As Object
For Each icbc In Application.CommandBars("cell").Controls
If icbc.Tag = "brccm" Then icbc.Delete
Next icbc
If Not Application.Intersect(Target, Range("b1:b10")) _
Is Nothing Then
With Application.CommandBars("cell").Controls _
.Add(Type:=msoControlButton, befo=6, _
temporary:=True)
.Caption = "New Context Menu Item"
.OnAction = "MyMacro"
.Tag = "brccm"
End With
End If
End Sub
On Sep 21, 10:34 pm, diddy_david
wrote:
I've created custom a custom menu with various macros, how can I display this
as a popup (shortcut) menu when a cell is right clicked?
|