private void btnSearch_Click(object sender, RibbonControlEventArgs e) { Excel.Workbook wkBK = Globals.ThisAddIn.Application.ActiveWorkbook; if (wkBK.IsWorkSheet(sheetName) != true) { System.Windows.Forms.MessageBox.Show("搜索的工作表不存在!", "温馨提示"); } else { wkBK.Worksheets[sheetName].Activate(); System.Windows.Forms.MessageBox.Show("已定位到指定的工作表中!", "恭喜你"); } }