VBA自定义菜单如何设置快捷键

合集下载

Excel2003_VBA自定义工具栏

Excel2003_VBA自定义工具栏

Excel2003_VBA自定义工具栏Excel2003 VBA 自定义工具栏在 Office 中通过 VBA 开发工具栏和菜单,需使用 Office 提供的 CommandBar、CommandBarButton、CommandBarComboBox 等对象,这些对象即代表工具栏、工具栏按钮和工具栏下拉框,通过这些对象可编制出各类复杂的工具栏或菜单。

mandBars 集合该集合代表 Office 所有的工具栏,可用名称或索引号指定菜单栏或工具栏,但仅可用名称指定一个菜单、快捷菜单或子菜单。

如两个或两个以上自定义菜单或子菜单名称相同,则返回第一个具有该名称的对象。

其 Add 方法用于新建一个工具栏,并返回 CommandBar 对象。

语法:expression.AddName Position MenuBar Temporary 参数说明: Name 为可选的 Variant 类型,代表新工具栏的名称。

如果省略,则使用默认的名称;Position 为可选的 Variant 类型,代表新工具栏的位置。

该参数值可通过 VBA常量进行设置,如 msoBarLeft、msoBarTop、msoBarRight、msoBarBottom 常量设置新工具栏位于软件工具栏中位置;msoBarFloating 常量代表新工具栏可移动;msoBarPopup 常量代表新工具栏为快捷菜单等;MenuBar 为可选的 Variant 类型,用于设置是否用新工具栏替换活动工具栏; Temporary 为可选的 Variant 类型,用于设置新工具栏是否暂时有效。

mandBar 对象该对象代表应用程序中的工具栏,新建工具栏的控件均以该对象为载体。

1Controls 属性:返回 CommandBarControls 对象,代表指定工具栏中的所有控件。

2NameLocal 属性:返回由应用程序版本语言所设置的工具栏名称,如对软件的内置工具栏设置会出现错误。

VBA中的Excel界面自定义指南

VBA中的Excel界面自定义指南

VBA中的Excel界面自定义指南Excel是一个功能强大的电子表格程序,可以帮助用户处理大量的数据和执行各种运算。

而VBA(Visual Basic for Applications)是Excel的内置编程语言,可以让用户以编程的方式自动化Excel的操作。

在Excel中,用户可以通过自定义界面来优化他们的工作流程,提高工作效率。

本文将重点介绍如何使用VBA自定义Excel界面,以便更好地适应个人需求。

1. 自定义菜单和工具栏Excel的菜单和工具栏提供了许多常用功能和命令,但有时候我们可能需要更多特定于个人需求的功能。

通过VBA,我们可以自定义菜单和工具栏,添加自己定义的命令和功能。

首先,我们需要打开Excel的开发工具。

在Excel的菜单栏上,选择“文件”->“选项”,然后在弹出的对话框中选择“自定义功能区”。

点击“自定义功能区”后,可以看到“主选项卡”和“定制功能区”两栏。

在“定制功能区”中,我们可以添加自定义的菜单和工具栏。

在VBA编辑器中,我们可以使用以下代码来添加自定义的菜单:```vbaSub AddCustomMenu()mandBars("Worksheet MenuBar").Controls.Add(Type:=msoControlPopup,Temporary:=True).Caption = "自定义菜单"With mandBars("Worksheet Menu Bar").Controls("自定义菜单").Controls.Add.Caption = "命令1".Controls.Add.Caption = "命令2"End WithEnd Sub```这段代码会在Excel的菜单栏上添加一个名为“自定义菜单”的菜单,并在该菜单下添加两个命令:“命令1”和“命令2”。

使用VBA创建自定义菜单和工具栏

使用VBA创建自定义菜单和工具栏

使用VBA创建自定义菜单和工具栏在Microsoft Office软件中,自定义菜单和工具栏是提高工作效率的重要工具。

通过使用VBA(Visual Basic for Applications)编程语言,可以轻松创建自定义菜单和工具栏,以满足个人或团队的需求。

在本文中,我将介绍如何使用VBA创建自定义菜单和工具栏,同时提供一些实用的示例来帮助读者了解如何在不同的Office应用程序中应用这些技巧。

首先,在应用程序打开的情况下,打开VBA编辑器。

可以通过按下`Alt + F11`快捷键,或在“开发者”选项卡中点击“Visual Basic”按钮来打开VBA编辑器。

接下来,我们将创建一个自定义菜单。

在VBA编辑器中,点击“插入”菜单,然后选择“模块”,这将创建一个新的代码模块。

在代码模块中,输入以下代码:```Sub CreateCustomMenu()Dim cMenuBar As CommandBarDim cMenu As CommandBarPopup'删除已存在的自定义菜单On Error Resume NextmandBars("Custom Menu").DeleteOn Error GoTo 0'创建新的自定义菜单Set cMenuBar = mandBars.Add(Name:="Custom Menu", _Position:=msoBarTop, MenuBar:=False, Temporary:=True)Set cMenu = cMenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)With cMenu.Caption = "Custom Menu"'添加菜单项.Controls.Add(Type:=msoControlButton, Temporary:=True).Caption = "菜单项1".Controls.Add(Type:=msoControlButton, Temporary:=True).Caption = "菜单项2".Controls.Add(Type:=msoControlButton, Temporary:=True).Caption = "菜单项3"End WithEnd Sub```在上面的代码中,我们首先删除已经存在的名为“Custom Menu”的自定义菜单,以确保我们创建的菜单是最新的。

VBA中的快捷键设置与应用技巧

VBA中的快捷键设置与应用技巧

VBA中的快捷键设置与应用技巧VBA(Visual Basic for Applications)是一种用于进行自动化操作的编程语言,常用于Microsoft Office软件中,如Word、Excel、PowerPoint等。

它可以帮助用户通过编写宏来提高工作效率和减少重复性操作。

在VBA中,设置和使用快捷键是一个非常实用的技巧,可以进一步提高工作效率。

本文将介绍VBA中的快捷键设置与应用技巧,帮助读者更好地利用VBA进行自动化操作。

一、设置自定义的快捷键在VBA中,通过设置自定义的快捷键,可以方便地执行特定的操作。

下面是设置自定义快捷键的步骤:1. 打开VBA编辑器:在需要设置快捷键的Office软件中,按下“Alt +F11”键,即可打开VBA编辑器。

2. 选择代码窗口:在VBA编辑器中,选择你需要设置快捷键的模块或代码窗口。

3. 打开属性窗口:在VBA编辑器的“视图”菜单中,选择“属性窗口”选项,即可打开属性窗口。

4. 设置快捷键:在属性窗口中,找到“名称”属性,双击该属性,即可编辑快捷键。

输入你想要的快捷键组合,如Ctrl+Shift+P。

5. 编写VBA代码:在代码窗口中,编写你想要执行的VBA代码。

例如,你可以编写一个用于插入当前日期的代码。

6. 关闭VBA编辑器:保存你的VBA代码,并关闭VBA编辑器。

现在,你可以使用你设置的快捷键组合来执行相应的操作。

按下你设置的快捷键时,VBA代码将会被执行,完成相应的任务。

二、常用的快捷键技巧除了设置自定义的快捷键,VBA中还有一些常用的快捷键技巧,可以帮助用户更高效地进行编程和操作。

1. 执行代码:在VBA编辑器的代码窗口中,按下“F5”键,即可执行当前选中的VBA代码。

这对于测试代码和调试程序非常有用。

2. 注释代码:在VBA编辑器的代码窗口中,选中需要注释的代码,然后按下“Ctrl + Shift + C”键,即可将选中的代码添加注释。

用VBA自定义WORD菜单和工具栏

用VBA自定义WORD菜单和工具栏

用VBA自定义WORD菜单和工具栏,实现多风格界面使用一个包含VBA代码的Word模板文件,通过“加载”方式直接运行,运行后将在Word XP的主界面中新增菜单和工具栏,并提供了几套适合不同工作环境的界面布局,单击相应菜单即可实现不同风格界面布局的切换。

标准风格:显示主菜单栏以及常用、格式两个工具栏,并将文本编辑区设置为“蓝底白字”。

简单风格:仅显示主菜单栏和程序新建的工具栏,并将文本编辑区恢复为“白底黑字”,如图1所示。

单击工具栏上的按钮,则会显示对话框。

绘图和制表风格:显示主菜单栏和常用、格式、绘图、图片、符号栏以及表格和边框工具栏等,并将文本编辑区恢复为“白底黑字”。

多风格界面的实现方法:一、创建工具栏和菜单的相关知识:mandBars集合Office软件中,每个软件所有的工具栏均可用该集合来代表,该集合可通过名称或索引号来指定菜单栏或工具栏,如“CommandBars("Formatting")”,即通过名称“Formatting”指定了“格式工具栏”。

Add方法用于新建工具栏,并返回CommandBar对象。

mandBar对象该对象代表工具栏,新建工具栏的控件均以该对象为载体,是VBA工具栏开发的核心对象,其常用方法和属性如下:Position属性:用于设置工具栏的位置,可通过VBA常量将工具栏的位置设置为置顶、居左、居右、置下或浮动。

Visible属性:用于设置工具栏是否可见。

Enabled属性:用于设置工具栏是否可用。

Reset方法:将内置工具栏的设置重置为默认设置,删除其中的自定义控件,在恢复软件原有工具栏或菜单时非常有用。

mandBarPopup 对象该对象代表工具栏中的一个弹出式控件,其实Office软件的菜单也可理解为一个弹出式的控件,而菜单栏可以视为“另类”的工具栏。

因此,通过该对象即可添加菜单栏,方法和添加工具栏类似。

mandBarButton对象该对象代表工具栏的按钮控件,是常用的工具栏二次开发控件,其常用方法和属性如下:OnAction属性:用于设置VBA代码过程名(该代码过程不可使用参数),该过程在单击按钮后运行。

VBA与宏命令快捷键的自定义与优化

VBA与宏命令快捷键的自定义与优化

VBA与宏命令快捷键的自定义与优化VBA(Visual Basic for Applications)是一种宏语言,用于在Microsoft Office套件中创建自定义功能。

它为用户提供了许多强大的功能来自动化任务、增强工作流程和提高效率。

同时,VBA还支持自定义快捷键以加快操作速度和提升用户体验。

在本篇文章中,我们将探讨如何自定义VBA和宏命令的快捷键,并优化其使用。

首先,自定义VBA的快捷键可以帮助我们更快地调用常用的功能或程序。

在VBA编辑器中,我们可以通过按下Alt + F11快捷键打开VBA编辑器。

然后,在"工具"菜单中选择"自定义键盘"选项。

在弹出的对话框中,选择"宏"分类并找到您想要自定义快捷键的命令。

单击"当前快捷键"框,然后按下您想要设置的快捷键组合。

最后,单击"分配"按钮以将快捷键与所选命令绑定。

除了自定义VBA的快捷键,我们还可以为宏命令分配快捷键以加速操作。

宏命令是一系列在Office应用程序中执行的操作组合。

您可以使用它们来自动化重复的任务,例如创建报告或填写表格。

为宏命令设置快捷键可以使您更轻松地调用和执行它们。

要为宏命令设置快捷键,首先打开Office应用程序的宏命令编辑器。

在Word和Excel中,您可以通过按下Alt + F8快捷键打开宏命令编辑器。

然后,在"宏名称"列表中选择您要分配快捷键的宏命令。

单击"选项"按钮,然后在"快捷键"框中输入您想要设置的快捷键组合。

请注意,您选择的快捷键必须是未使用的。

最后,单击"确定"按钮以保存更改。

除了自定义快捷键,我们还可以通过优化VBA和宏命令来提高其性能和效率。

以下是一些优化建议:1. 使用变量:在编写代码时,尽量使用变量存储和操作数据。

这可以减少内存使用量,并提高代码执行速度。

VBA菜单和工具栏定制技巧

VBA菜单和工具栏定制技巧

VBA菜单和工具栏定制技巧VBA(Visual Basic for Applications)是一种强大的编程语言,可以集成到Microsoft Office套件中,帮助用户自定义功能和加强应用程序的自动化。

在Microsoft Office中,菜单和工具栏是我们经常使用的功能,通过VBA的定制技巧,我们可以根据自己的需求自定义菜单和工具栏,提高工作效率和用户体验。

本文将介绍一些VBA菜单和工具栏定制的技巧,帮助用户快速掌握这一强大的功能。

一、自定义菜单1. 添加自定义菜单项在VBA编辑器中,我们可以使用“CustomMenus”对象添加自定义菜单项。

首先,打开VBA编辑器(Alt + F11),然后在左侧的项目浏览器中选择对应的工作簿。

接下来,右键点击工作簿名称,在弹出的菜单中选择“插入”→“模块”。

在新建的模块中,输入以下代码:```vbaSub AddCustomMenuItem()CommandBars("Worksheet menu bar").Controls("自定义菜单").Controls.Add Type:=msoControlButton, before:=2CommandBars("Worksheet menu bar").Controls("自定义菜单").Controls(1).Caption = "自定义菜单项"End Sub```该代码将在工作表的菜单栏中添加一个名称为“自定义菜单”的菜单,并在菜单中添加一个名称为“自定义菜单项”的菜单项。

2. 添加快捷键要给自定义菜单项添加快捷键,可以使用以下代码:```vbaSub AddShortcutKey()CommandBars("Worksheet menu bar").Controls("自定义菜单").Controls(1).OnAction = "CustomMenuItem_Click"CommandBars("Worksheet menubar").FindControl(ID:=30010).ShortcutText = "Ctrl+Shift+C"End SubSub CustomMenuItem_Click()' 自定义菜单项的功能代码End Sub```在上述代码中,“CustomMenuItem_Click”是自定义菜单项的点击事件处理程序,用户可以通过修改这一事件处理程序的代码来实现所需的功能。

VBA实现自定义菜单与工具栏的步骤与技巧

VBA实现自定义菜单与工具栏的步骤与技巧

VBA实现自定义菜单与工具栏的步骤与技巧自定义菜单和工具栏是VBA中非常有用的功能,能够提供更加灵活和高效的用户界面。

通过自定义菜单和工具栏,我们可以根据自己的需求添加或删除菜单项和工具按钮,使得用户能够方便地访问所需的功能。

本文将介绍如何使用VBA实现自定义菜单与工具栏的步骤与技巧。

一、创建自定义菜单要创建自定义菜单,首先需要打开Visual Basic编辑器(VBE),然后按下ALT+F11快捷键。

在VBE中,选择“插入” -> “用户窗体”或者右键单击项目资源管理器中的该工作簿并选择“插入模块”。

在新的用户窗体或模块中,输入以下代码,以创建一个名为"CustomMenu"的自定义菜单。

```vbaSub CreateCustomMenu()Dim cBar As CommandBarDim cBarControl As CommandBarControl' 如果已经存在名称为"CustomMenu"的菜单,则删除它On Error Resume NextmandBars("CustomMenu").DeleteOn Error GoTo 0' 创建自定义菜单Set cBar = mandBars.Add(Name:="CustomMenu", Position:=msoBarPopup, _MenuBar:=False, Temporary:=True)' 添加菜单项Set cBarControl = cBar.Controls.Add(Type:=msoControlButton)With cBarControl.Caption = "菜单项1".OnAction = "Macro1"End WithSet cBarControl = cBar.Controls.Add(Type:=msoControlButton)With cBarControl.BeginGroup = True.Caption = "菜单项2".OnAction = "Macro2"End WithEnd SubSub Macro1()' 菜单项1的宏代码End SubSub Macro2()' 菜单项2的宏代码End Sub```在创建的自定义菜单中,我们通过`CommandBar`对象和`CommandBarControl`对象来创建和添加菜单项。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Static Sub AddMenu() '添加自定义菜单Dim NewMenuBar As CommandBarDim CX As CommandBarControl, JC As CommandBarControl, TB As CommandBarControl, SJ As CommandBarControl, BF As CommandBarControlDim DY As CommandBarControl, BZ As CommandBarControl, XX As CommandBarControl, USE As CommandBarControl, WH As CommandBarControl Dim CW As CommandBarControl, TJ As CommandBarControl, LJC As CommandBarControl, YZ2 As CommandBarControl, YJC As CommandBarControl Dim LDQ As CommandBarControl, LNB As CommandBarControl, SDQ As CommandBarControl, SNB As CommandBarControl, LAll As CommandBarControl Dim JSB As CommandBarControl, SAll As CommandBarControl, DDQ As CommandBarControl, DNB As CommandBarControl, CDQ As CommandBarControl Dim CNB As CommandBarControl, C0 As CommandBarControl, CTZ As CommandBarControl, BF1 As CommandBarControl, BF2 As CommandBarControl Dim BF8 As CommandBarControl, DY1 As CommandBarControl, DY2 As CommandBarControl, SM As CommandBarControl, FG As CommandBarControlDim KK As CommandBarControl, Bh1 As CommandBarControl, Bh2 As CommandBarControl, JB1 As CommandBarControl, JB2 As CommandBarControl Dim KB As CommandBarControl, FZ As CommandBarControl, SY As CommandBarControl, CZ As CommandBarControl, Z1 As CommandBarControlDim Z2 As CommandBarControl, NH As CommandBarControl, B1 As CommandBarControl, B2 As CommandBarControl, B3 As CommandBarControl, BD As CommandBarControlDim B5 As CommandBarControl, B6 As CommandBarControl, S1 As CommandBarControl, S2 As CommandBarControl, S3 As CommandBarControlDim S5 As CommandBarControl, S6 As CommandBarControl, D1 As CommandBarControl, D2 As CommandBarControl, D3 As CommandBarControlDim D5 As CommandBarControl, D6 As CommandBarControl, C1 As CommandBarControl, C2 As CommandBarControl, C3 As CommandBarControlDim C5 As CommandBarControl, C6 As CommandBarControl, TJF As CommandBarControl, TL As CommandBarControl, CL As CommandBarControlDim ClCells As CommandBarControl, ShHL As CommandBarControlApplication.ScreenUpdating = FalseOn Error Resume NextMenuBars("MyMenuBar").Delete'定义菜单Set NewMenuBar = CommandBars.Add(MenuBar:=True) = "MyMenuBar"NewMenuBar.Visible = True'定义一级菜单项Set CX = NewMenuBar.Controls.Add(Type:=msoControlPopup) CX.Caption = "程序设置"CX.Visible = TrueSet JC = NewMenuBar.Controls.Add(Type:=msoControlPopup) JC.Caption = "基础数据"JC.Visible = TrueSet TB = NewMenuBar.Controls.Add(Type:=msoControlPopup) TB.Caption = "报表审录"TB.Visible = TrueSet SJ = NewMenuBar.Controls.Add(Type:=msoControlPopup) SJ.Caption = "数据处理"SJ.Visible = TrueSet BF = NewMenuBar.Controls.Add(Type:=msoControlPopup) BF.Caption = "报表备份"BF.Visible = TrueSet DY = NewMenuBar.Controls.Add(Type:=msoControlPopup) DY.Caption = "打印控制"DY.Visible = TrueSet BZ = NewMenuBar.Controls.Add(Type:=msoControlPopup) BZ.Caption = "帮助信息"BZ.Visible = True'定义二级菜单项Set XX = CX.Controls.Add(Type:=msoControlButton) With XX.Caption = "企业信息".OnAction = "ShowXX".FaceId = 1016End WithSet USE = CX.Controls.Add(Type:=msoControlButton) With USE.Caption = "操作设定".OnAction = "UserSet".FaceId = 1980End WithSet TIM = CX.Controls.Add(Type:=msoControlButton) With TIM.Caption = "报表时期".OnAction = "ChangeMonth".BeginGroup = True '菜单选项之间的分隔线End WithSet WH = CX.Controls.Add(Type:=msoControlPopup) With WH.Caption = "报表维护".BeginGroup = True '菜单选项之间的分隔线End WithSet CW = JC.Controls.Add(Type:=msoControlPopup) With CW.Caption = "财务报表"End WithSet TJ = JC.Controls.Add(Type:=msoControlPopup)With TJ.Caption = "统计数据"End WithSet LJC = JC.Controls.Add(Type:=msoControlButton) With LJC.Caption = "基础数据综合录入".BeginGroup = True '菜单选项之间的分隔线.OnAction = "ShowJC".FaceId = 353End WithSet YZ2 = JC.Controls.Add(Type:=msoControlButton) With YZ2.Caption = "增表二数据套用".BeginGroup = True '菜单选项之间的分隔线.OnAction = "CountZ1".FaceId = 211End WithSet YJC = JC.Controls.Add(Type:=msoControlButton) With YJC.Caption = "基础数据导入主表".BeginGroup = True '菜单选项之间的分隔线.OnAction = "CountJC".FaceId = 938End WithSet LDQ = TB.Controls.Add(Type:=msoControlPopup) With LDQ.Caption = "录入定期报表"End WithSet LNB = TB.Controls.Add(Type:=msoControlButton) With LNB.Caption = "录入年报报表".OnAction = "ShowNB" '无.FaceId = 162End WithSet SDQ = TB.Controls.Add(Type:=msoControlPopup) With SDQ.Caption = "定期报表审核".BeginGroup = True '菜单选项之间的分隔线End WithSet SNB = TB.Controls.Add(Type:=msoControlButton) With SNB.Caption = "年报报表审核".OnAction = "CheckNB".FaceId = 172End WithSet JSB = TB.Controls.Add(Type:=msoControlButton) With JSB.Caption = "表间数据计算".OnAction = "CountBB".FaceId = 283.BeginGroup = True '菜单选项之间的分隔线End WithSet LAll = TB.Controls.Add(Type:=msoControlButton) With LAll.Caption = "当期报表通录".BeginGroup = True '菜单选项之间的分隔线.OnAction = "ShowBB".FaceId = 212End WithSet SAll = TB.Controls.Add(Type:=msoControlButton) With SAll.Caption = "当期报表全审".OnAction = "CheckBB".FaceId = 790.BeginGroup = True '菜单选项之间的分隔线End WithSet DDQ = SJ.Controls.Add(Type:=msoControlPopup) With DDQ.Caption = "定期数据导入"End WithSet DNB = SJ.Controls.Add(Type:=msoControlButton) With DNB.Caption = "年报数据导入".OnAction = "InNB".FaceId = 237End WithSet CDQ = SJ.Controls.Add(Type:=msoControlPopup) With CDQ.Caption = "生成定期数据".BeginGroup = True '菜单选项之间的分隔线End WithSet CNB = SJ.Controls.Add(Type:=msoControlButton) With CNB.Caption = "生成年报报表数据".FaceId = 762.OnAction = "OutNB"End WithSet C0 = SJ.Controls.Add(Type:=msoControlButton) With C0.Caption = "生成全部数据".FaceId = 721.OnAction = "OutAll".BeginGroup = True '菜单选项之间的分隔线End WithSet CTZ = SJ.Controls.Add(Type:=msoControlButton) With CTZ.Caption = "生成统计台账".FaceId = 222.OnAction = "OutTZ"End WithSet BF1 = BF.Controls.Add(Type:=msoControlButton) With BF1.Caption = "备份定期报表".FaceId = 356.OnAction = "Copy1"End WithSet BF2 = BF.Controls.Add(Type:=msoControlButton) With BF2.Caption = "备份年报套表".FaceId = 1665.OnAction = "Copy2"End WithSet BF8 = BF.Controls.Add(Type:=msoControlButton) With BF8.Caption = "程序数据表转存".FaceId = 749.OnAction = "CopyAll".BeginGroup = True '菜单选项之间的分隔线If Man = 0 Then.Enabled = FalseEnd IfEnd WithSet DY0 = DY.Controls.Add(Type:=msoControlButton) With DY0.Caption = "预览调整".FaceId = 25.OnAction = "Print0"End WithSet DY1 = DY.Controls.Add(Type:=msoControlButton) With DY1.Caption = "打印当前报表".FaceId = 4.OnAction = "Print1"End WithSet SM = BZ.Controls.Add(Type:=msoControlButton) With SM.Caption = "程序说明".FaceId = 984.OnAction = "Help"End WithSet FG = BZ.Controls.Add(Type:=msoControlPopup)With FG.Caption = "统计法规参考".BeginGroup = True '菜单选项之间的分隔线End WithSet BB = BZ.Controls.Add(Type:=msoControlButton)With BB.Caption = "程序版本信息".OnAction = "ShowKK".FaceId = 809.BeginGroup = True '菜单选项之间的分隔线End With'定义三级菜单项Set JB1 = WH.Controls.Add(Type:=msoControlButton) With JB1.Caption = "工作表解锁".FaceId = 916.OnAction = "JB1"End WithSet Bh1 = WH.Controls.Add(Type:=msoControlButton)With Bh1.Caption = "锁定工作表".FaceId = 894.OnAction = "Bh1"End WithSet JB2 = WH.Controls.Add(Type:=msoControlButton)With JB2.Caption = "工作簿解锁".FaceId = 719.OnAction = "JB2".BeginGroup = True '菜单选项之间的分隔线If Man = 0 Then.Enabled = FalseEnd IfEnd WithSet Bh2 = WH.Controls.Add(Type:=msoControlButton)With Bh2.Caption = "锁定工作簿".FaceId = 718.OnAction = "Bh2"If Man = 0 Then.Enabled = FalseEnd IfEnd WithSet DelCell = WH.Controls.Add(Type:=msoControlButton) With DelCell.Caption = "清除本月表内数据".FaceId = 20.OnAction = "Clear1".BeginGroup = True '分隔线End WithSet ClCells = WH.Controls.Add(Type:=msoControlButton) With ClCells.Caption = "清除本表所有数据".OnAction = "ClearAll"If Man = 0 Then.Enabled = FalseEnd IfEnd WithSet SHL = WH.Controls.Add(Type:=msoControlButton) With SHL.Caption = "行列编辑信息".FaceId = 11.OnAction = "ShowRC".BeginGroup = True '分隔线If Man = 0 Then.Enabled = FalseEnd IfEnd WithSet KB = WH.Controls.Add(Type:=msoControlButton)With KB.Caption = "查阅所有表".FaceId = 8.OnAction = "ShowAll".BeginGroup = True '分隔线If Man = 0 Then.Enabled = FalseEnd IfEnd WithSet FZ = CW.Controls.Add(Type:=msoControlButton) With FZ.Caption = "资产负债表".FaceId = 133.OnAction = "ShowFZ"End WithSet SY = CW.Controls.Add(Type:=msoControlButton) With SY.Caption = "损益(利润)表".FaceId = 136.OnAction = "ShowSY"End WithSet CZ = TJ.Controls.Add(Type:=msoControlButton) With CZ.Caption = "总产值计算表".FaceId = 17.OnAction = "ShowCZ".BeginGroup = True '分隔线End WithSet Z1 = TJ.Controls.Add(Type:=msoControlButton) With Z1.Caption = "增加值计算表一".FaceId = 144.OnAction = "ShowZ1"End WithSet Z2 = TJ.Controls.Add(Type:=msoControlButton) With Z2.Caption = "增加值计算表二".FaceId = 144.OnAction = "ShowZ2"End WithSet NH = TJ.Controls.Add(Type:=msoControlButton) With NH.Caption = "能耗记录表".FaceId = 107.OnAction = "ShowNH"End WithSet B1 = LDQ.Controls.Add(Type:=msoControlButton) With B1.Caption = "B201表".FaceId = 483.OnAction = "Show201"End WithSet B2 = LDQ.Controls.Add(Type:=msoControlButton) With B2.Caption = "B202表".FaceId = 481.OnAction = "Show202"End WithSet B3 = LDQ.Controls.Add(Type:=msoControlButton) With B3.Caption = "B203表".FaceId = 484.OnAction = "Show203".BeginGroup = True '分隔线End WithSet B5 = LDQ.Controls.Add(Type:=msoControlButton) With B5.Caption = "P205表".FaceId = 482.OnAction = "Show205"End WithSet B6 = LDQ.Controls.Add(Type:=msoControlButton) With B6.Caption = "P206表".FaceId = 59.OnAction = "Show206".BeginGroup = True '分隔线End WithSet BD = LDQ.Controls.Add(Type:=msoControlButton) With BD.Caption = "乡企定综1表".FaceId = 1763.OnAction = "ShowD1".BeginGroup = True '分隔线End WithSet S1 = SDQ.Controls.Add(Type:=msoControlButton) With S1.Caption = "B201表".FaceId = 329.OnAction = "Check201"End WithSet S2 = SDQ.Controls.Add(Type:=msoControlButton) With S2.Caption = "B202表".OnAction = "Check202"End WithSet S3 = SDQ.Controls.Add(Type:=msoControlButton) With S3.Caption = "B203表".FaceId = 107.OnAction = "Check203".BeginGroup = True '分隔线End WithSet S5 = SDQ.Controls.Add(Type:=msoControlButton) With S5.Caption = "P205表".OnAction = "Check205"End WithSet S6 = SDQ.Controls.Add(Type:=msoControlButton) With S6.Caption = "P206表".FaceId = 1715.OnAction = "Check206".BeginGroup = True '分隔线End WithSet D1 = DDQ.Controls.Add(Type:=msoControlButton) With D1.Caption = "B201表".FaceId = 239.OnAction = "In201".BeginGroup = True '分隔线End WithSet D2 = DDQ.Controls.Add(Type:=msoControlButton) With D2.Caption = "B202表".OnAction = "In202".BeginGroup = True '分隔线End WithSet D3 = DDQ.Controls.Add(Type:=msoControlButton) With D3.Caption = "P203表".FaceId = 317.OnAction = "In203".BeginGroup = True '分隔线End WithSet D5 = DDQ.Controls.Add(Type:=msoControlButton) With D5.Caption = "P205表".OnAction = "In205"End WithSet D6 = DDQ.Controls.Add(Type:=msoControlButton) With D6.Caption = "P206表".FaceId = 271.OnAction = "In206".BeginGroup = True '分隔线End WithSet C1 = CDQ.Controls.Add(Type:=msoControlButton) With C1.Caption = "B201表".FaceId = 538.OnAction = "Out201"End WithSet C2 = CDQ.Controls.Add(Type:=msoControlButton) With C2.Caption = "B202表".OnAction = "Out202"End WithSet C3 = CDQ.Controls.Add(Type:=msoControlButton) With C3.Caption = "B203表".FaceId = 439.OnAction = "Out203".BeginGroup = True '分隔线End WithSet C5 = CDQ.Controls.Add(Type:=msoControlButton) With C5.Caption = "P205表".OnAction = "Out205"End WithSet C6 = CDQ.Controls.Add(Type:=msoControlButton) With C6.Caption = "P206表".FaceId = 270.OnAction = "Out206".BeginGroup = True '分隔线End WithSet TJF = FG.Controls.Add(Type:=msoControlButton) With TJF.Caption = "统计法".FaceId = 463.OnAction = "ShowTJF"End WithSet TL = FG.Controls.Add(Type:=msoControlButton) With TL.Caption = "统计管理条例".FaceId = 942.OnAction = "ShowTL"End WithSet CL = FG.Controls.Add(Type:=msoControlButton) With CL.Caption = "自由裁量权".FaceId = 983.OnAction = "ShowCLQ"End WithApplication.MacroOptions Macro:="show201", HasShortcutKey:=True, ShortcutKey:="1"Application.ScreenUpdating = TrueEnd Sub。

相关文档
最新文档