我需要
1)从“单元格”右键单击上下文菜单中禁用以下所有选项
a. Paste options
b. Insert
c. Delete
d. Format Cell
2)禁用“列”右键单击上下文菜单中的以下所有选项
a. Paste options
b. Insert
c. Delete
d. Clear Content
e. Format Cell
3)从“行”右键单击上下文菜单禁用以下所有选项
a. Paste options
b. Insert Copied Cells only (Not Insert)
c. Format Cell
4)在特定范围的行(例如行1至3)的“行”右键单击上下文菜单中禁用以下所有选项
a. Insert
b. Delete
c. Clear Content
5)从“表单控制按钮”右键单击上下文菜单中禁用以下所有选项
a. Format Control
感谢任何帮助
这里是实现所需目标的简单方法。对于大多数用户,您可以使用右键菜单中显示的内容。例如,对于Insert
,您会看到Insert...
。
Application.CommandBars("Cell").Controls("Insert...").Visible = True 'False
为他人而Si惜。我尚未找到禁用Paste Options:
或其中的图标的方法。但是,您可以使用Paste Special
]禁用我上面提到的Paste Options:
下的Paste Special...
。
注意
:嗯,这是您最少的问题。请记住,用户仍然可以使用功能区或快捷键来实现您禁用的那些功能;)编辑
不幸的是,这对我不起作用。它与表格有关系吗?因为单元格是表的一部分! – 8分钟前Afshin Davoudy
是,必须使用
Application.CommandBars("List Range Popup").Controls("Delete").Visible = False
BEFORE
AFTER
Afshin Davoudy:如何禁用“列”上下文菜单中的选项?还是行? (来自扩展聊天)
使用
Application.CommandBars("Column").Controls("Delete").Visible = False
Application.CommandBars("Row").Controls("Delete").Visible = False