很多个相同的菜单出现,无法删除
Private Sub Workbook_BeforeClose(Cancel As Boolean) '删除“成绩汇总”工具栏 flg = "tbar_deled" '设置“工具栏已删除”标志(WindowDeactivate过程引用) Application.CommandBars("aaaa").Delete End Sub
Private Sub Workbook_Open() '建立“成绩汇总”工具栏 Set tbar = Application.CommandBars.Add(Name:="aaaa") Application.StatusBar = "百佳出品, 必属精品! 欢迎访问新科标资源网 http://www.xinkebiao.cn" '在工具栏上添加“清除数据”命令按钮 Set butt1 = tbar.Controls.Add(Type:=msoControlButton) With butt1 .Caption = "成绩录入" .Style = msoButtonCaption .OnAction = "成绩录入" '指定要执行的过程 End With '在工具栏上添加“成绩校对”命令按钮 Set butt2 = tbar.Controls.Add(Type:=msoControlButton) With butt2 .Caption = "成绩校对" .Style = msoButtonCaption .OnAction = "成绩校对" '指定要执行的过程 End With Set butt12 = tbar.Controls.Add(Type:=msoControlButton) With butt12 .Caption = "打印校对表" .Style = msoButtonCaption .OnAction = "校对表打印模板" '指定要执行的过程 End With '在工具栏上添加“更新X科排名”命令按钮 Set butt3 = tbar.Controls.Add(Type:=msoControlButton) With butt3 .Caption = "更新X科排名" .Style = msoButtonCaption .OnAction = "更新X科排名" '指定要执行的过程 End With '在工具栏上添加“获取客观题成绩”命令按钮 Set butt4 = tbar.Controls.Add(Type:=msoControlButton) With butt4 .Caption = "拆分工作表为工作簿" .Style = msoButtonCaption .OnAction = "将当前活动工作簿的若干工作表拆分成若干工作簿" '指定要执行的过程 End With '在工具栏上添加“更新答案”命令按钮 Set butt5 = tbar.Controls.Add(Type:=msoControlButton) With butt5 .Caption = "获取学生成绩" .Style = msoButtonCaption .OnAction = "获取学生成绩模块" '指定要执行的过程 End With '在工具栏上添加“计算得分率”命令按钮 Set butt6 = tbar.Controls.Add(Type:=msoControlButton) With butt6 .Caption = "计算权重" .Style = msoButtonCaption .OnAction = "计算权重" '指定要执行的过程 End With Set butt7 = tbar.Controls.Add(Type:=msoControlButton) With butt7 .Caption = "成绩汇总" .Style = msoButtonCaption .OnAction = "成绩汇总" '指定要执行的过程 End With Set butt8 = tbar.Controls.Add(Type:=msoControlButton) With butt8 .Caption = "综合科得分率" .Style = msoButtonCaption .OnAction = "综合科得分率" '指定要执行的过程 End With Set butt9 = tbar.Controls.Add(Type:=msoControlButton) With butt9 .Caption = "行列管理行" .Style = msoButtonCaption .OnAction = "行列1" '指定要执行的过程 End With Set butt10 = tbar.Controls.Add(Type:=msoControlButton) With butt10 .Caption = "分段统计" .Style = msoButtonCaption .OnAction = "分段统计" '指定要执行的过程 End With Set butt11 = tbar.Controls.Add(Type:=msoControlButton) With butt11 .Caption = "关于" .Style = msoButtonCaption .OnAction = "关于" '指定要执行的过程 End With '在工具栏上添加“导入”命令按钮 tbar.Visible = True End Sub '以下用于登陆窗口设置 ' Private Sub Workbook_Open() 'Application.Visible = False 'UserForm1.Show 'End Sub
|