大鳥的學(xué)習(xí)樂園
          路漫漫其修遠兮,吾將上下而求索
          posts - 26,comments - 27,trackbacks - 0

           

          Private Sub Workbook_Open()

              Dim cbr As CommandBar
              Dim ctrMenu As CommandBarControl
              Dim ctr As CommandBarControl
             
              Set cbr = Application.CommandBars("Worksheet Menu Bar")
             
              For Each ctr In cbr.Controls
             
                  If ctr.Caption = "custom" Then
                      Exit Sub
                  End If
             
              Next
             
             
              Set ctlMenu = cbr.Controls.Add(Type:=msoControlPopup)
             
              With ctlMenu
                     .Caption = "custom"
                      With .Controls.Add(Type:=msoControlButton)
                          .Caption = "aa"
                          .OnAction = "action1"
                      End With
                      With .Controls.Add(Type:=msoControlButton)
                          .Caption = "bb"
                        
                          .OnAction = "action2"
                      End With
              End With
             
          End Sub

          posted on 2009-08-13 15:25 大鳥 閱讀(235) 評論(0)  編輯  收藏 所屬分類: VBA
          主站蜘蛛池模板: 上栗县| 景洪市| 吴忠市| 云林县| 陇南市| 万安县| 望城县| 白银市| 福清市| 十堰市| 红河县| 盐津县| 永州市| 玉林市| 卢氏县| 广东省| 南江县| 陆河县| 宁乡县| 奉新县| 叶城县| 淮滨县| 铁力市| 甘肃省| 兰考县| 大宁县| 娄烦县| 始兴县| 双城市| 黄石市| 玉树县| 如东县| 富平县| 科技| 十堰市| 汉川市| 普安县| 格尔木市| 黔西| 渝中区| 吴堡县|