如何用VBA代码为Word添加菜单(即命令栏)?
答案:1 悬赏:0 手机版
解决时间 2021-02-18 18:59
- 提问者网友:寂寞梧桐
- 2021-02-18 16:09
谢谢这位兄台。可是这个菜单只能增加。却不能删除。如何在关闭WORD时自动删除呢?
最佳答案
- 五星知识达人网友:枭雄戏美人
- 2021-02-18 17:46
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
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯