1
我是Excel插件程序設計新手。我在C#中爲Excel 2010創建了一個Excel插件,它將在每張工作簿中創建按鈕。Excel加載項按鈕
有人能告訴我什麼是錯,此代碼:
Excel.Worksheet activeWorksheet = Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet;
Microsoft.Office.Tools.Excel.Worksheet vstoWorksheet = activeWorksheet.GetVstoObject(Globals.Factory);
Excel.Range selection = vstoWorksheet.Range[2, 2];
Microsoft.Office.Tools.Excel.Controls.Button button = new Microsoft.Office.Tools.Excel.Controls.Button();
button.Tag = vstoWorksheet.Controls.AddControl(button,selection, "Click"); button.Name = "Click";
button.BackColor = System.Drawing.Color.Cyan;
button.Text = "Click";
微軟大約有一個整體網站它在這裏http://msdn.microsoft.com/en-us/office/hh133430.aspx – Jesse
Excel.Worksheet activeWorksheet =Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet; Microsoft.Office.Tools.Excel.Worksheet vstoWorksheet = activeWorksheet.GetVstoObject(Globals.Factory); Excel.Range selection = vstoWorksheet.Range[2, 2]; Microsoft.Office.Tools.Excel.Controls.Button button = new Microsoft.Office.Tools.Excel.Controls.Button(); button.Tag = vstoWorksheet.Controls.AddControl(button,selection, "Click"); button.Name = "Click"; button.BackColor = System.Drawing.Color.Cyan; button.Text = "Click";
有人可以告訴我這段代碼有什麼問題。 – Abhinav