Sunday, March 20, 2016

How to disable Right Click Option in the Excel with VBA

Workbook and Worksheet Events to Disable the  Right Click Option in the Excel
WorkSheet Event :
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)

Cancel = True

 MsgBox ("Sorry the Right Click is Disabled in this WorkSheet")
End Sub


WorkBook Event :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)

Cancel = True

 MsgBox ("Sorry The Right Click is Disabled for this Workbook")
End Sub



--------------------------------------------------------------------------------------------------------
Thanks, TAMATAM ; Business Intelligence & Analytics Professional
--------------------------------------------------------------------------------------------------------

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. If you wish, please share your genuine Feedback or comments only related to this Blog Posts. It is my humble request that, please do not post any Spam comments or Advertising kind of comments, which will be Ignored.