来个菜单设置: Sub Menu_Face() '设置界面菜单
On Error Resume Next
Dim Popup(2)
Dim Button As CommandBarControl
CommandBars("My").Delete
Set Popup(0) = Application.CommandBars.Add(Name:="MY", Position:=msoBarTop, MenuBar:=True) 'MenuBar:=True为菜单
With Popup(0)
.Protection = msoBarNoMovem '返回或设置指定命令栏的保护方式,以防止用户改动
.Visible = True
End With
Set Popup(1) = Popup(0).Controls.Add(Type:=msoControlPopup, Temporary:=True)
Popup(1).Caption = " 文件控制 "
Call MyButton(Popup(1), False, " 1. 用户切换", 355, "Login", True)
Call MyButton(Popup(1), False, " 2. 文件存盘", 3, "File_Save", True)
Call MyButton(Popup(1), False, " 3. 密码修改", 548, "Pass_Modify", True)
Call MyButton(Popup(1), False, " 4. 退出文件", 1019, "File_Close", True)
Set Popup(1) = Popup(0).Controls.Add(Type:=msoControlPopup, Temporary:=True)
Popup(1).Caption = " 数据处理 "
Call MyButton(Popup(1), False, " 1. 福彩数据", 162, "Data_3D", True)
Call MyButton(Popup(1), False, " 2. 体彩数据", 162, "Data_P3", True)
Call MyButton(Popup(1), True, " 3. 往期查看", 439, "Data_See", False)
Set Popup(1) = Popup(0).Controls.Add(Type:=msoControlPopup, Temporary:=True)
Popup(1).Caption = " 图表查看 "
Set Popup(2) = Popup(1).Controls.Add(Type:=msoControlPopup, Temporary:=True)
Popup(2).Caption = " 1. 和值"
Call MyButton(Popup(2), False, " 1.1 竖排", 17, "Data_B1", True)
Call MyButton(Popup(2), False, " 1.2 横排", 17, "Data_B2", True)
Set Popup(2) = Popup(1).Controls.Add(Type:=msoControlPopup, Temporary:=True)
Popup(2).Caption = " 2. 合值"
Call MyButton(Popup(2), False, " 2.1 合值", 17, "Data_B3", True)
Call MyButton(Popup(2), False, " 2.2 合值跨度", 17, "Data_B4", True)
Call MyButton(Popup(1), True, " 3. 跨度", 17, "Data_B5", True)
Set Popup(2) = Popup(1).Controls.Add(Type:=msoControlPopup, Temporary:=True)
Popup(2).Caption = " 4. 开奖号码"
Call MyButton(Popup(2), False, " 4.1 大中小", 17, "Data_B7", True)
Call MyButton(Popup(2), False, " 4.2 012路", 17, "Data_B8", True)
Call MyButton(Popup(2), True, " 4.3 竖排", 17, "Data_BSG", True)
Call MyButton(Popup(2), False, " 4.4 横排", 17, "Data_B6", True)
Call MyButton(Popup(2), True, " 4.5 百位", 17, "Data_B12", True)
Call MyButton(Popup(2), False, " 4.6 十位", 17, "Data_B13", True)
Call MyButton(Popup(2), False, " 4.7 个位", 17, "Data_B14", True)
Set Popup(2) = Popup(1).Controls.Add(Type:=msoControlPopup, Temporary:=True)
Popup(2).Caption = " 5. 大小奇偶质合"
Call MyButton(Popup(2), False, " 5.1 百位", 17, "Data_B9", True)
Call MyButton(Popup(2), False, " 5.2 十位", 17, "Data_B10", True)
Call MyButton(Popup(2), False, " 5.3 个位", 17, "Data_B11", True)
Set Popup(1) = Popup(0).Controls.Add(Type:=msoControlPopup, Temporary:=True)
Popup(1).Caption = " 文件信息 "
Call MyButton(Popup(1), False, " 1. 注册信息", 607, "File_Register", True)
Call MyButton(Popup(1), False, " 2. 关于作者", 487, "About", True)
Call MyButton(Popup(1), True, " 3. 返回主页", 132, "Back_Face", True)
Set Popup(1) = Popup(0).Controls.Add(Type:=msoControlPopup, Temporary:=True)
With Popup(1)
.Caption = " 玩法选择(&X) "
.FaceId = 439
.OnAction = "Data_See"
.Enabled = False
End With
End Sub
Sub MyButton(MyPopup, BeginGroup As Boolean, Caption As String, FaceId As Integer, OnAction As String, Enabled As Boolean)
Set Button = MyPopup.Controls.Add(Type:=msoControlButton)
Button.BeginGroup = BeginGroup '菜单隔断
Button.Caption = Caption '菜单名称
Button.FaceId = FaceId '菜单图标
Button.OnAction = OnAction '执行宏名
Button.Enabled = Enabled '菜单灰白否
End Sub |