Sub createMenus()
    Dim cmdBar As CommandBar
    Dim cmdMenu As CommandBarPopup
    Dim cmdBtn As CommandBarButton
    Set cmdBar = Application.CommandBars("WorkSheet Menu Bar")
    'Set cmdBar = Application.CommandBars(1)
    With cmdBar
        Set cmdMenu = .Controls.Add(Type:=msoControlPopup, before:=4, temporary:=True)
        With cmdMenu
            .Caption = "工具箱(&K)"
            With .Controls.Add(Type:=msoControlButton)
                .Caption = "神奇按钮(&K)"
                .OnAction = "神奇按钮"
                .FaceId = 185
            End With
            With .Controls.Add(Type:=msoControlButton)
                .Caption = "显示所有工作表(D)"
                .OnAction = "显示所有工作表"
                .FaceId = 12
            End With
            With .Controls.Add(Type:=msoControlButton)
                .Caption = "卸载软件(&U)"
                .OnAction = "卸载"
                .FaceId = 12
            End With
        End With
    End With
End Sub

  

相关文章:

  • 2021-07-14
  • 2021-12-24
  • 2022-12-23
猜你喜欢
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-10-18
  • 2022-12-23
  • 2021-10-04
相关资源
相似解决方案