打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
commandbars知多少
在一般的应用程序中,有电子表格,但是反映不出来菜单栏、常用工具栏、格式工具栏、编辑栏等等,那是因为:
Sub test()
'视图工具栏中,各种工具对应的英文名称
'worksheet menu bar表示工作表菜单栏 ,编号是 1
Application.CommandBars("worksheet menu bar").Enabled = False
'formatting表示格式工具栏,编号 4
Application.CommandBars("Formatting").Visible = False
'standard表示常用工具栏,编号 3
Application.CommandBars("Standard").Visible = falsae
'Toolbar list表示右键工具栏
Application.CommandBars("Toolbar list").Enabled = False
'Ply表示屏蔽工作表标签栏右键菜单
Application.CommandBars("Ply").Enabled = False
'Cell表示鼠标右键点工作表区域出来的快捷菜单,编号是 36
Application.CommandBars("Cell ").Enabled = False
'drawing表示绘图工具栏
Application.CommandBars("Drawing").Visible = False
'control toolbox表示控件工具箱
Application.CommandBars("Control Toolbox").Visible = False
'reviewing表示审阅工具
Application.CommandBars("Reviewing").Visible = False
Application.CommandBars("金山快译").Visible = False
'dispalyformulabar表示编辑栏
Application.DisplayFormulaBar = False
Application.CommandBars("Visual Basic").Visible = False
Application.CommandBars("Web").Visible = False
Application.CommandBars("Protection").Visible = False
Application.CommandBars("Borders").Visible = False
Application.CommandBars("Forms").Visible = False
Application.CommandBars("Formula Auditing").Visible = False
Application.CommandBars("Watch Window").Visible = False
'pivottable表示数据透视表
Application.CommandBars("PivotTable").Visible = False
'chart表示图表
Application.CommandBars("Chart").Visible = False
'picture表示图片
Application.CommandBars("Picture").Visible = False
Application.CommandBars("Exit Design Mode").Visible = False
'external data表示外部数据
Application.CommandBars("External Data").Visible = False
End Sub
别忘了在thisworkbook模块中加上下面的事件,用于还原菜单栏等
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("worksheet menu bar").Enabled = True
Application.CommandBars("Formatting").Visible = True
Application.CommandBars("Standard").Visible = True
Application.CommandBars("Drawing").Visible = True
Application.CommandBars("Control Toolbox").Visible = True
Application.CommandBars("Reviewing").Visible = True
Application.CommandBars("金山快译").Visible = True
Application.DisplayFormulaBar = True
End Sub
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
excel 隐藏缺省界面的vba代码 隐藏Excel2003菜单栏和工具栏
Excel VBA 工具栏隐藏、显示
Excel vba通过Application.CommandBars.FindControl的方法禁...
在Excel 中自定义菜单栏和工具栏-添加、删除、禁止等
VBS操作Word
VBA常用代码解析(第二十一讲)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服