EXCEL 自定义菜单

2020-03-05 11:34:14 浏览数 (1)

Sub XXXscrap()

Dim XXX As CommandBarPopup Dim scrap As CommandBarPopup Dim about As CommandBarControl

Dim finderror As CommandBarControl Dim cleanup As CommandBarControl Dim updatascrap As CommandBarControl

‘菜单栏出现公司名称 Set XXX = Application.CommandBars("Worksheet Menu Bar").Controls.Add(Type:=msoControlPopup) XXX.Caption = "XXX公司"

‘点击XXX公司,出现两个子项 Set scrap = XXX.CommandBar.Controls.Add(Type:=msoControlPopup) scrap.Caption = "Scrap"

Set about = XXX.CommandBar.Controls.Add(Type:=msoControlButton, ID:=2950) about.Caption = "About" about.OnAction = "abouttony"

‘点击scrap,出现三个子项 Set cleanup = scrap.CommandBar.Controls.Add(Type:=msoControlButton) cleanup.Caption = "Clean up data" cleanup.OnAction = "cleanuptony"

Set finderror = scrap.CommandBar.Controls.Add(Type:=msoControlButton) finderror.Caption = "Find error data" finderror.OnAction = "finderrortony"

Set updatascrap = scrap.CommandBar.Controls.Add(Type:=msoControlButton) updatascrap.Caption = "Updata Scrap" updatascrap.OnAction = "updatascraptony"

End Sub

0 人点赞