禁用形状的右键菜单 [英] Disable right click menu of shapes

查看:72
本文介绍了禁用形状的右键菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以禁用诸如VBA中的矩形?

Is there a way to disable the right click menu for shapes like e.g. rectangles in VBA?

我尝试过:

Private Sub Workbook_Open()
'    Application.WindowState = xlMaximized
    Application.DisplayFullScreen = True
    Application.CommandBars("Ply").Enabled = False
    Application.CommandBars("Shapes").Enabled = False
End Sub

但这似乎不起作用.

推荐答案

右键单击菜单(又名上下文菜单)不是命令栏.

The right-click menu (aka, context menu) is not a Command Bar.

您可能会通过命令栏的较早名称​​ Toolbars 或它们的较新名称​​ Ribbons 来了解它们.

You may know Command Bars by their older name, Toolbars, or their newer name, Ribbons.

尽管您可以 捕获和/或禁用工作表上的右键单击事件,此不适用于形状之类的对象.

Although you can capture and/or disable a right-click event on a worksheet, this doesn't apply to objects like shapes.

但是,可以通过保护工作表免受更改(使用或不使用密码)来防止显示上下文菜单.

However, you can prevent the context menu from showing by protecting the worksheet from changes (with or without a password).

如有必要,您可以允许用户进行某些更改,而不能进行其他更改.有关更多信息,请参见

If necessary you can allow some changes, but not others, to be made by the user. More information at this link.

这篇关于禁用形状的右键菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆