VBA代码,仅在当前工作簿中禁用Excel中的“右键单击"选项 [英] VBA Code for disable the Right Click option in Excel for the current Workbook only
本文介绍了VBA代码,仅在当前工作簿中禁用Excel中的“右键单击"选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在工作簿中创建了多个工作表.
我想让我的用户不允许在excel中查看其他工作表.
由于我想在Excel打开事件中禁用右键单击选项.
I have created multiple worksheets in my workbook.
I want to my users are not allowing to see the other sheets in excel.
Since I want to disable the right click option in Excel open event.
我有一段代码:
Private Sub Workbook_SheetBeforeRightClick (ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Cancel = True
MsgBox ("Sorry Right Click is Disabled for this Workbook")
End Sub
以上代码仅在打开工作簿并运行宏后运行.
我想在打开工作簿时禁用该工作簿的右键单击选项.
The above code runs only after opening the Workbook and run the Macro.
I want to disable right click option the Workbook when opening the Workbook.
推荐答案
尝试一下,使用不同的参数...
Try this, different parameters...
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
End Sub
这篇关于VBA代码,仅在当前工作簿中禁用Excel中的“右键单击"选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文