zoukankan      html  css  js  c++  java
  • excel2003 增加菜单

     添加一菜单:

    工具 ->

    自定义... ->

    命令(tab) ->

    重排命令(Btn) ->

    工具栏 (Radio Btn) ->

    工作表菜单栏 (dropdown list) ->

    增加(Btn)  ->

    新菜单 (Select) ->

    确定(Btn) ->

    更改所选内容 (Btn) -> 这里可以改名、删除、指定宏等 

    给菜单增加子菜单:

    菜单栏选之前建的 -> 增加 -> 宏 -> 自定义菜单项 -> 确定 

    VBA代码方式增加菜单:

        Dim cbMainMenuBar As CommandBar
        Dim cbcCutomMenu As CommandBarControl
        On Error Resume Next
        Application.CommandBars("Worksheet Menu Bar").Controls(
    "新菜单(&N)").Delete
        On Error GoTo 0
        Set cbMainMenuBar = Application.CommandBars("Worksheet Menu Bar")
        Set cbcCutomMenu = cbMainMenuBar.Controls.Add(Type:=msoControlPopup)
        cbcCutomMenu.Caption = cutomMainMenuText
        With cbcCutomMenu.Controls.Add(Type:=msoControlButton)
            .Caption = "子菜单1(&P)"
            .OnAction = "子菜单1事件"
        End With
        With cbcCutomMenu.Controls.Add(Type:=msoControlButton)
            .Caption = "子菜单1(&H)"
            .OnAction = "子菜单2事件"
            .BeginGroup = True
        End With
        With cbcCutomMenu.Controls.Add(Type:=msoControlButton)
            .Caption = "子菜单3(&S)"
            .OnAction = "子菜单3事件"
        End With
     

    删除菜单VBA代码:

        On Error Resume Next
        Application.CommandBars("Worksheet Menu Bar").Controls("新菜单(&N)").Delete
        On Error GoTo 0

  • 相关阅读:
    POJ 1041(欧拉路)
    POJ 1904(强连通分量)Tarjan
    POJ 1486(二分图匹配)二分图的完全匹配的必须边
    POJ 1780(欧拉路)
    POJ 1386(欧拉路)
    HDU 3496(DP)
    PKU2387Til the Cows Come Home(SPFA+邻接表)
    HDU1863畅通工程(prim)
    ACM国内外OJ网站大集合
    HDU1175连连看(BFS)
  • 原文地址:https://www.cnblogs.com/abinxm/p/2276820.html
Copyright © 2011-2022 走看看