如何用VBA代码为Word添加菜单(即命令栏)?
1个回答
展开全部
Dim myMenuBar
Dim newMenu
Dim ctrl1
Dim s
Dim flag As String
'初局毁始化菜单
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "电子印章"
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "添加桐友备电子印章"
ctrl1.Style = msoButtonCaption
ctrl1.OnAction = "AddSeal"
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "验证电子印章"
ctrl1.Style = msoButtonCaption
ctrl1.OnAction = "CheckSeal"
ctrl1.Style = msoButtonCaption
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "告世关于"
ctrl1.OnAction = "About"
ctrl1.Style = msoButtonCaption
Dim newMenu
Dim ctrl1
Dim s
Dim flag As String
'初局毁始化菜单
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "电子印章"
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "添加桐友备电子印章"
ctrl1.Style = msoButtonCaption
ctrl1.OnAction = "AddSeal"
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "验证电子印章"
ctrl1.Style = msoButtonCaption
ctrl1.OnAction = "CheckSeal"
ctrl1.Style = msoButtonCaption
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "告世关于"
ctrl1.OnAction = "About"
ctrl1.Style = msoButtonCaption
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询