Application app = null;
private void ThisAddIn_Startup(object sender, EventArgs e)
{
app = Globals.ThisAddIn.Application;
}
//每次打开发现无网络,excel关闭了
private void App_WorkbookOpen(Workbook Wb)
{
if (Tool.ConnectionStatus() == false)
{
MessageBox.Show("操作excel表请确保有网络!");
//这行开启,会导致其他打开的excel也会关闭
//app.Quit();
Wb.Application.DisplayAlerts = false;
Wb.Close();
return;
}
}