书中的示例有错误? commandbar.add 无法执行?
Const TOOLBARNAME As String = "工资条生成器"Private Sub Workbook_AddinInstall()Dim tbar As CommandBarDim btn As CommandBarButton'如果已经存在工具栏按钮则删除旧的On Error Resume NextCommandBars(TOOLBARNAME).DeleteOn Error GoTo 0'创建新工具栏'''''''''''''''''''''''''''''''''这里执行不下去''''''''''''''''''''''提示对象变量或with块变量未设置,为啥?Set tbar = CommandBars.AddWith tbar .Name = TOOLBARNAME .Visible = TrueEnd With'添加一个按钮Set btn = tbar.Controls.Add(Type:=msoControlButton)With btn btn.FaceId = 300 btn.OnAction = "main" btn.Caption = "点此启动工资条生成器"End WithEnd Sub