vba屏蔽Excel中的菜单功能
1、屏蔽“菜单”中的项:眼睛总是流眼泪是什么原因
Application.CommandBars(1).Controls("⽂件(&F)").Enabled = Fal '屏蔽⽂件菜单
教育学专业Application.CommandBars(1).Controls("编辑(&E)").Enabled = Fal '屏蔽编辑菜单
苹果里的星星Application.CommandBars(1).Controls("视图(&V)").Enabled = Fal '屏蔽视图菜单
Application.CommandBars(1).Controls("插⼊(&I)").Enabled = Fal '屏蔽插⼊菜单
Application.CommandBars(1).Controls("格式(&O)").Enabled = Fal '屏蔽格式菜单
Application.CommandBars(1).Controls("⼯具(&T)").Enabled = Fal '屏蔽⼯具菜单
Application.CommandBars(1).Controls("数据(&D)").Enabled = Fal '屏蔽数据菜单
花的词语Application.CommandBars(1).Controls("窗⼝(&W)").Enabled = Fal '屏蔽窗⼝菜单
有时候造句Application.CommandBars(1).Controls("帮助(&H)").Enabled = Fal '屏蔽帮助菜单
雀的笔顺
2、屏蔽“菜单”中的⼦项:
Application.CommandBars(1).Controls("编辑(&E)").Controls("填充(&I)").Enabled = Fal '屏蔽“编辑”菜单中的“填充”项Application.CommandBars(1).Controls("⼯具(&T)").Controls("选项(&O)...").Visible = Fal '去除⼯具-选项
Application.CommandBars(1).Controls("⼯具(&T)").Controls("选项(&O)...").Enabled = Fal '⼯具-选项变灰⾊
3、禁⽤粘贴:
Application.CommandBars("Cell").Controls("粘贴(&P)").Enabled = Fal '禁⽤右键粘贴
Application.CommandBars("Cell").Controls("选择性粘贴(&S)...").Enabled = Fal
Application.CommandBars(1).Controls("编辑(&E)").Controls("粘贴(&P)").Enabled = Fal
Application.CommandBars(1).Controls("编辑(&E)").Controls("选择性粘贴(&S)...").Enabled = Fal
Application.CommandBars(1).Controls("编辑(&E)").Controls("office 剪贴板(&B)...").Enabled = Fal
Application.CommandBars(3).Controls("粘贴(&P)").Enabled = Fal
Application.CommandBars.DisableCustomize = True
毛细血管壁4、其他
Application.CommandBars(1).Controls("⼯具(&T)").Controls("⾃定义(&C)...").Enabled = Fal
Application.OnKey "^v", "" '禁⽤键盘"Ctrl+V"
Application.OnKey "^v" '恢复键盘"Ctrl+V"
Application.CommandBars.DisableAskAQuestionDropdown = True '去除⼯作表右上⾓的帮助栏
Application.CommandBars("Reviewing").Visible = Fal '屏蔽审阅
Application.CommandBars("Formula Auditing").Visible = Fal '屏蔽公式审核
Application.CommandBars("Control Toolbox").Visible = Fal '屏蔽控件⼯具箱
Application.CommandBars("Stop Recording").Visible = Fal '屏蔽录制宏
资料管理Application.CommandBars("Forms").Visible = Fal '屏蔽窗体
Application.CommandBars("Drawing").Visible = Fal '屏蔽绘图
5、屏蔽/解除整段代码:
视图-》⼯具栏-》编辑,选中代码,然后在编辑的⼯具栏⾥“设置注释块和“解除注释块”按钮
Application.EnableCancelKey = xlDisabled '应⽤程序的EnableCancelKey=完全禁⽤“取消”键捕获功能
Application.EnableCancelKey = xlInterrupt '应⽤程序的EnableCancelKey=中断当前运⾏程序,⽤户可进⾏调试或结束程序的运⾏