- UID
- 384482
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2006-1-17
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Sub AddUserCommandBar()
Const ButtonCount = 6
Dim UserButtonStyleAndAction(ButtonCount, 5)
Dim NewBar, mybar As CommandBar
Dim NewButton, MyButton As CommandBarButton
Dim Flag_MyBarExist As Boolean
Const MyBarName = "MengChengLinNew"
'定义按钮的外观及动作
UserButtonStyleAndAction(1, 1) = "系统登陆"
UserButtonStyleAndAction(1, 2) = "系统登陆"
UserButtonStyleAndAction(1, 3) = 481
UserButtonStyleAndAction(1, 4) = msoButtonIconAndCaption
UserButtonStyleAndAction(1, 5) = "UserEnter"
UserButtonStyleAndAction(2, 1) = "模板编辑"
UserButtonStyleAndAction(2, 2) = "模板编辑"
UserButtonStyleAndAction(2, 3) = 495
UserButtonStyleAndAction(2, 4) = msoButtonIconAndCaption
UserButtonStyleAndAction(2, 5) = "uMoBanEdit"
UserButtonStyleAndAction(3, 1) = "打开历史档案"
UserButtonStyleAndAction(3, 2) = "打开历史档案"
UserButtonStyleAndAction(3, 3) = 46
UserButtonStyleAndAction(3, 4) = msoButtonIconAndCaption
UserButtonStyleAndAction(3, 5) = "uFindAndOpenLiShi"
UserButtonStyleAndAction(4, 1) = "状态报告"
UserButtonStyleAndAction(4, 2) = "状态报告"
UserButtonStyleAndAction(4, 3) = 198
UserButtonStyleAndAction(4, 4) = msoButtonIconAndCaption
UserButtonStyleAndAction(4, 5) = "TestForJianCe"
UserButtonStyleAndAction(5, 1) = "保存退出"
UserButtonStyleAndAction(5, 2) = "工作表保存并退出"
UserButtonStyleAndAction(5, 3) = 271
UserButtonStyleAndAction(5, 4) = msoButtonIconAndCaption
UserButtonStyleAndAction(5, 5) = "uSaveAndCancle"
UserButtonStyleAndAction(6, 1) = "关于"
UserButtonStyleAndAction(6, 2) = "关于我们"
UserButtonStyleAndAction(6, 3) = 343
UserButtonStyleAndAction(6, 4) = msoButtonIconAndCaption
UserButtonStyleAndAction(6, 5) = "uAbout"
'按钮定义结束
'填加工具栏——MengChengLin
Flag_MyBarExist = False
For Each cbar In CommandBars
If cbar.Name = MyBarName Then Flag_MyBarExist = True
Next
If Flag_MyBarExist = False Then
Set NewBar = CommandBars.Add(Name:=MyBarName, Position:=msoBarFloating, Temporary:=True)
End If
Set mybar = CommandBars(MyBarName)
mybar.Visible = True
mybar.Position = msoBarTop
'填加工具栏结束
'填加命令按钮——“作业指导书编制系统”、“搜索历史档案”、“登记历史档案”、“打印工序流转卡”、“保存退出”
For i = 1 To ButtonCount
Set NewButton = mybar.Controls.Add(msoControlButton)
With NewButton
.Caption = UserButtonStyleAndAction(i, 1)
.TooltipText = UserButtonStyleAndAction(i, 2)
.FaceId = UserButtonStyleAndAction(i, 3)
.Style = UserButtonStyleAndAction(i, 4)
.OnAction = UserButtonStyleAndAction(i, 5)
End With
Next i
End Sub |
|