先学习右键有什么快捷键
- Sub 列出右键菜单_芐雨()
- On Error Resume Next
- Dim mc As CommandBarControl
- x = 1
- Cells(x, 1) = "Index"
- Cells(x, 2) = "Caption"
- Cells(x, 3) = "ID"
- For Each mc In Application.CommandBars("cell").Controls
- Cells(x + 1, 1) = mc.Index
- Cells(x + 1, 2) = mc.Caption
- Cells(x + 1, 3) = mc.ID
- x = x + 1
- Next
- End Sub
删除Delete
- Sub 删除_芐雨()
- Application.CommandBars("cell").Controls("显示拼音字段(&S)").Delete '用名字识别删除
- Application.CommandBars("cell").Controls(17).Delete 'Index识别删除
- End Sub
添加Add
- Sub 添加_芐雨()
- Application.CommandBars("cell").Controls.Add ID:=1614, before:=17 '在index17前面添加id为1614
- End Sub
重置Reset
- Sub 恢复_芐雨()
- '将内置 CommandBarControl 重置为其初始功能和图符,重置一个内置命令栏将删除其中的自定义控件并恢复其内置控件
- Application.CommandBars("cell").Reset
- End Sub
|