c# 开发excel工具栏
c#增加工具栏,如何绑定点击工具栏按钮的事件.请高手解答下. 我的代码绑定的弹出窗体只能弹出一次.
             MsExcel.Application excelapp = (MsExcel.Application)app;
             CommandBar commandbar = excelapp.Application.CommandBars.Add("c# tool", MsoBarPosition.msoBarTop, false, true);
             commandbar.Visible = true;
             CommandBarButton _btn = (CommandBarButton)commandbar.Controls.Add(MsoControlType.msoControlButton, missing, missing, missing, true);
             _btn.Caption = "caption";
             _btn.Tag = "name";
             _btn.Style = MsoButtonStyle.msoButtonCaption;
             _btn.TooltipText = "caption";
             _btn.Click += btnToolbarButton_Click;
         protected void btnToolbarButton_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
         {           
             Form aa = new Form1();  
             aa.Show ();
         }
------解决方案--------------------
按钮的变量 放 到 全局 上去!
------解决方案--------------------