When the user right-clicks in a worksheet, Excel displays a shortcut menu. If, for some reason, you'd like to prevent the shortcut menu from appearing in a particular sheet, you can trap the RightClick event. The following procedure sets the Cancel argument to True, which cancels the RightClick event and thereby cancels the shortcut menu. Instead, a message box is displayed.
Private Sub Worksheet_BeforeRightClick _
(ByVal Target As Excel.Range, Cancel As Boolean) Cancel = True
MsgBox "The shortcut menu is not available." End Sub
Chapter 24 describes other methods to disable shortcut menus.
Was this article helpful?