BeforeRightClick() and Cell menu
ahhh .... i see .... ok, i'll do that
"Jim Rech" wrote in message
...
I haven't run into this but then I believe you're not really using the
before_right_click event in the intended way. The idea is not to
customize
the Cell menu real-time, but to display your own popup commandbar. An
example in case you want to change course:
In your startup code create a custom popup:
Sub MakePopup()
On Error Resume Next
CommandBars("MyCell").Delete
On Error GoTo 0
With CommandBars.Add("MyCell", msoBarPopup, False, True)
.Controls.Add msoControlButton, 19 ''Built-in Copy command
With .Controls.Add(msoControlButton, 1)
.Caption = "My Custom Menu item"
.OnAction = "DoBeep"
End With
End With
End Sub
Sub DoBeep()
Beep
End Sub
And then the event handler can show it:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True ''Kill Excel's Cell menu
CommandBars("MyCell").ShowPopup ''Show ours
End Sub
--
Jim Rech
Excel MVP
|