以下代码是做在工具栏上的,是别人帮我做的。
Sub CreateToolBar()
On Error Resume Next
CommandBars("Custom Toolbar").Delete
On Error GoTo 0
With CommandBars.Add(Name:="Custom Toolbar", Position:=msoBarTop)
.Visible = True
With .Controls.Add(Type:=msoControlButton)
.Caption = "统计"
.Style = msoButtonCaption
.TooltipText = "统计"
.OnAction = "MakeSum"
End With
End With
End Sub
Sub RemoveToolBar()
On Error Resume Next
CommandBars("Custom Toolbar").Delete
End Sub