|
上下放置没试出来,以后有答案了再来贴。- Sub AddCommandbar()
- Dim i As Byte
- 'For i = 0 To 6
- On Error Resume Next
- Application.CommandBars("hwc2ycy").Delete
- Application.CommandBars.Add "hwc2ycy", 1, , True
- Application.CommandBars("hwc2ycy").Visible = True
- With Application.CommandBars("hwc2ycy").Controls
- With .Add(1, , , , True)
- .Caption = "button1"
- .Visible = True
- .Style = msoButtonIconAndCaption
- .FaceId = 11
- .OnAction = "test"
- End With
- With .Add(1, , , , True)
- .Caption = "button2"
- .Visible = True
- .Style = msoButtonIconAndCaption
- .FaceId = 22
- .OnAction = "test"
- End With
- With .Add(1, , , , True)
- .Caption = "button3"
- .Visible = True
- .Style = msoButtonIconAndCaption
- .FaceId = 44
- .OnAction = "test"
- End With
- End With
- End Sub
- Sub test()
- MsgBox "test1"
- End Sub
复制代码 |
|