VBA自定义菜单如何设置快捷键培训资料.docx
- 文档编号:11763936
- 上传时间:2023-06-02
- 格式:DOCX
- 页数:21
- 大小:16.84KB
VBA自定义菜单如何设置快捷键培训资料.docx
《VBA自定义菜单如何设置快捷键培训资料.docx》由会员分享,可在线阅读,更多相关《VBA自定义菜单如何设置快捷键培训资料.docx(21页珍藏版)》请在冰点文库上搜索。
VBA自定义菜单如何设置快捷键培训资料
VBA自定义菜单如何设置快捷键
StaticSubAddMenu()'添加自定义菜单
DimNewMenuBarAsCommandBar
DimCXAsCommandBarControl,JCAsCommandBarControl,TBAsCommandBarControl,SJAsCommandBarControl,BFAsCommandBarControl
DimDYAsCommandBarControl,BZAsCommandBarControl,XXAsCommandBarControl,USEAsCommandBarControl,WHAsCommandBarControl
DimCWAsCommandBarControl,TJAsCommandBarControl,LJCAsCommandBarControl,YZ2AsCommandBarControl,YJCAsCommandBarControl
DimLDQAsCommandBarControl,LNBAsCommandBarControl,SDQAsCommandBarControl,SNBAsCommandBarControl,LAllAsCommandBarControl
DimJSBAsCommandBarControl,SAllAsCommandBarControl,DDQAsCommandBarControl,DNBAsCommandBarControl,CDQAsCommandBarControl
DimCNBAsCommandBarControl,C0AsCommandBarControl,CTZAsCommandBarControl,BF1AsCommandBarControl,BF2AsCommandBarControl
DimBF8AsCommandBarControl,DY1AsCommandBarControl,DY2AsCommandBarControl,SMAsCommandBarControl,FGAsCommandBarControl
DimKKAsCommandBarControl,Bh1AsCommandBarControl,Bh2AsCommandBarControl,JB1AsCommandBarControl,JB2AsCommandBarControl
DimKBAsCommandBarControl,FZAsCommandBarControl,SYAsCommandBarControl,CZAsCommandBarControl,Z1AsCommandBarControl
DimZ2AsCommandBarControl,NHAsCommandBarControl,B1AsCommandBarControl,B2AsCommandBarControl,B3AsCommandBarControl,BDAsCommandBarControl
DimB5AsCommandBarControl,B6AsCommandBarControl,S1AsCommandBarControl,S2AsCommandBarControl,S3AsCommandBarControl
DimS5AsCommandBarControl,S6AsCommandBarControl,D1AsCommandBarControl,D2AsCommandBarControl,D3AsCommandBarControl
DimD5AsCommandBarControl,D6AsCommandBarControl,C1AsCommandBarControl,C2AsCommandBarControl,C3AsCommandBarControl
DimC5AsCommandBarControl,C6AsCommandBarControl,TJFAsCommandBarControl,TLAsCommandBarControl,CLAsCommandBarControl
DimClCellsAsCommandBarControl,ShHLAsCommandBarControl
Application.ScreenUpdating=False
OnErrorResumeNext
MenuBars("MyMenuBar").Delete
'定义菜单
SetNewMenuBar=CommandBars.Add(MenuBar:
=True)
NewMenuBar.Name="MyMenuBar"
NewMenuBar.Visible=True
'定义一级菜单项
SetCX=NewMenuBar.Controls.Add(Type:
=msoControlPopup)
CX.Caption="程序设置"
CX.Visible=True
SetJC=NewMenuBar.Controls.Add(Type:
=msoControlPopup)
JC.Caption="基础数据"
JC.Visible=True
SetTB=NewMenuBar.Controls.Add(Type:
=msoControlPopup)
TB.Caption="报表审录"
TB.Visible=True
SetSJ=NewMenuBar.Controls.Add(Type:
=msoControlPopup)
SJ.Caption="数据处理"
SJ.Visible=True
SetBF=NewMenuBar.Controls.Add(Type:
=msoControlPopup)
BF.Caption="报表备份"
BF.Visible=True
SetDY=NewMenuBar.Controls.Add(Type:
=msoControlPopup)
DY.Caption="打印控制"
DY.Visible=True
SetBZ=NewMenuBar.Controls.Add(Type:
=msoControlPopup)
BZ.Caption="帮助信息"
BZ.Visible=True
'定义二级菜单项
SetXX=CX.Controls.Add(Type:
=msoControlButton)
WithXX
.Caption="企业信息"
.OnAction="ShowXX"
.FaceId=1016
EndWith
SetUSE=CX.Controls.Add(Type:
=msoControlButton)
WithUSE
.Caption="操作设定"
.OnAction="UserSet"
.FaceId=1980
EndWith
SetTIM=CX.Controls.Add(Type:
=msoControlButton)
WithTIM
.Caption="报表时期"
.OnAction="ChangeMonth"
.BeginGroup=True'菜单选项之间的分隔线
EndWith
SetWH=CX.Controls.Add(Type:
=msoControlPopup)
WithWH
.Caption="报表维护"
.BeginGroup=True'菜单选项之间的分隔线
EndWith
SetCW=JC.Controls.Add(Type:
=msoControlPopup)
WithCW
.Caption="财务报表"
EndWith
SetTJ=JC.Controls.Add(Type:
=msoControlPopup)
WithTJ
.Caption="统计数据"
EndWith
SetLJC=JC.Controls.Add(Type:
=msoControlButton)
WithLJC
.Caption="基础数据综合录入"
.BeginGroup=True'菜单选项之间的分隔线
.OnAction="ShowJC"
.FaceId=353
EndWith
SetYZ2=JC.Controls.Add(Type:
=msoControlButton)
WithYZ2
.Caption="增表二数据套用"
.BeginGroup=True'菜单选项之间的分隔线
.OnAction="CountZ1"
.FaceId=211
EndWith
SetYJC=JC.Controls.Add(Type:
=msoControlButton)
WithYJC
.Caption="基础数据导入主表"
.BeginGroup=True'菜单选项之间的分隔线
.OnAction="CountJC"
.FaceId=938
EndWith
SetLDQ=TB.Controls.Add(Type:
=msoControlPopup)
WithLDQ
.Caption="录入定期报表"
EndWith
SetLNB=TB.Controls.Add(Type:
=msoControlButton)
WithLNB
.Caption="录入年报报表"
.OnAction="ShowNB" '无
.FaceId=162
EndWith
SetSDQ=TB.Controls.Add(Type:
=msoControlPopup)
WithSDQ
.Caption="定期报表审核"
.BeginGroup=True'菜单选项之间的分隔线
EndWith
SetSNB=TB.Controls.Add(Type:
=msoControlButton)
WithSNB
.Caption="年报报表审核"
.OnAction="CheckNB"
.FaceId=172
EndWith
SetJSB=TB.Controls.Add(Type:
=msoControlButton)
WithJSB
.Caption="表间数据计算"
.OnAction="CountBB"
.FaceId=283
.BeginGroup=True'菜单选项之间的分隔线
EndWith
SetLAll=TB.Controls.Add(Type:
=msoControlButton)
WithLAll
.Caption="当期报表通录"
.BeginGroup=True'菜单选项之间的分隔线
.OnAction="ShowBB"
.FaceId=212
EndWith
SetSAll=TB.Controls.Add(Type:
=msoControlButton)
WithSAll
.Caption="当期报表全审"
.OnAction="CheckBB"
.FaceId=790
.BeginGroup=True'菜单选项之间的分隔线
EndWith
SetDDQ=SJ.Controls.Add(Type:
=msoControlPopup)
WithDDQ
.Caption="定期数据导入"
EndWith
SetDNB=SJ.Controls.Add(Type:
=msoControlButton)
WithDNB
.Caption="年报数据导入"
.OnAction="InNB"
.FaceId=237
EndWith
SetCDQ=SJ.Controls.Add(Type:
=msoControlPopup)
WithCDQ
.Caption="生成定期数据"
.BeginGroup=True'菜单选项之间的分隔线
EndWith
SetCNB=SJ.Controls.Add(Type:
=msoControlButton)
WithCNB
.Caption="生成年报报表数据"
.FaceId=762
.OnAction="OutNB"
EndWith
SetC0=SJ.Controls.Add(Type:
=msoControlButton)
WithC0
.Caption="生成全部数据"
.FaceId=721
.OnAction="OutAll"
.BeginGroup=True'菜单选项之间的分隔线
EndWith
SetCTZ=SJ.Controls.Add(Type:
=msoControlButton)
WithCTZ
.Caption="生成统计台账"
.FaceId=222
.OnAction="OutTZ"
EndWith
SetBF1=BF.Controls.Add(Type:
=msoControlButton)
WithBF1
.Caption="备份定期报表"
.FaceId=356
.OnAction="Copy1"
EndWith
SetBF2=BF.Controls.Add(Type:
=msoControlButton)
WithBF2
.Caption="备份年报套表"
.FaceId=1665
.OnAction="Copy2"
EndWith
SetBF8=BF.Controls.Add(Type:
=msoControlButton)
WithBF8
.Caption="程序数据表转存"
.FaceId=749
.OnAction="CopyAll"
.BeginGroup=True'菜单选项之间的分隔线
IfMan=0Then
.Enabled=False
EndIf
EndWith
SetDY0=DY.Controls.Add(Type:
=msoControlButton)
WithDY0
.Caption="预览调整"
.FaceId=25
.OnAction="Print0"
EndWith
SetDY1=DY.Controls.Add(Type:
=msoControlButton)
WithDY1
.Caption="打印当前报表"
.FaceId=4
.OnAction="Print1"
EndWith
SetSM=BZ.Controls.Add(Type:
=msoControlButton)
WithSM
.Caption="程序说明"
.FaceId=984
.OnAction="Help"
EndWith
SetFG=BZ.Controls.Add(Type:
=msoControlPopup)
WithFG
.Caption="统计法规参考"
.BeginGroup=True'菜单选项之间的分隔线
EndWith
SetBB=BZ.Controls.Add(Type:
=msoControlButton)
WithBB
.Caption="程序版本信息"
.OnAction="ShowKK"
.FaceId=809
.BeginGroup=True'菜单选项之间的分隔线
EndWith
'定义三级菜单项
SetJB1=WH.Controls.Add(Type:
=msoControlButton)
WithJB1
.Caption="工作表解锁"
.FaceId=916
.OnAction="JB1"
EndWith
SetBh1=WH.Controls.Add(Type:
=msoControlButton)
WithBh1
.Caption="锁定工作表"
.FaceId=894
.OnAction="Bh1"
EndWith
SetJB2=WH.Controls.Add(Type:
=msoControlButton)
WithJB2
.Caption="工作簿解锁"
.FaceId=719
.OnAction="JB2"
.BeginGroup=True'菜单选项之间的分隔线
IfMan=0Then
.Enabled=False
EndIf
EndWith
SetBh2=WH.Controls.Add(Type:
=msoControlButton)
WithBh2
.Caption="锁定工作簿"
.FaceId=718
.OnAction="Bh2"
IfMan=0Then
.Enabled=False
EndIf
EndWith
SetDelCell=WH.Controls.Add(Type:
=msoControlButton)
WithDelCell
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- VBA 自定义 菜单 如何 设置 快捷键 培训资料
![提示](https://static.bingdoc.com/images/bang_tan.gif)