Disable right click in workbook in Excel

To do it in Excel, here is the answer:

  1. Option Explicit
  2. Private Sub WorkSheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
  3. Cancel = True
  4. MsgBox "Shortcut Menu is disabled."
  5. End Sub

a) The above macro code needs to be included under the Sheet where "Right Click" has to be disabled. In the example below, the code is included in "Sheet1" - hence right click is disabled for "Sheet1".

excel disable right click in workbook

b) When user right clicks on "Sheet1" a message "Shortcut Menu is disabled" pops up as below.

excel disable right click in workbook

 

You can find similar Excel Questions and Answer hereunder

1) I want to automatically run a procedure whenever I close my WorkBook so that it is in a known state - how can I achieve that?

2) How to you use the events when the user clicks on message boxes on the screen.

3) How do you close, save, open files and do other operations in the workbook in VBA

4) How to do workbook protection with VBA in Excel

5) How can I quickly navigate to a frequently used field in a voluminous worbook?

6) Calling a macro from another workbook in Excel

7) How to disable ability to insert Rows and Columns in Excel (using VBA)?

8) Here we explain the thisWorkbook object and its functionalites

9) Vba code to password protect workbook in Excel

10) I want to automatically run an initialization procedure whenever I open my WorkBook so that it is ready for use - how can I achieve that?

 

Here the previous and next chapter