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
大鳥 閱讀(234)
評論(0) 編輯 收藏 所屬分類:
VBA