VSTOをはじめて作ってみたので、それのメモ
環境
C#
イベント処理
ThisAddIn.cs
//(省略)
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.WorkbookActivate += Application_Active;
this.Application.SheetActivate += Sheet_Active;
}
void Application_Active(Excel.Workbook wb)
{
//起動時の処理を書きます~
Excel.Worksheet activeWorksheet = ((Excel.Worksheet)Application.ActiveSheet);
MessageBox.Show(activeWorksheet.Name, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
void Sheet_Active(object sh)
{
//シートアクティブの処理を書きます~
Excel.Worksheet activeWorksheet = ((Excel.Worksheet)Application.ActiveSheet);
MessageBox.Show(activeWorksheet.Name, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information);
}