public override bool CopyTechSpecs(int sheetIndex) { int sheetsAllCount = excel.GetSheetsCount(); int sheetsVisCount = excel.GetSheetsCount(false); int iCount = 1, sCount = 1; bool inSearch = true; while (inSearch) { excel.SetSheetByIndex(iCount); if (excel.CheckSheetVisibility()) { if (sCount == sheetIndex) { excel.CopySheetToBuffer(sheetIndex); return(true); } else { sCount++; } } iCount++; if (iCount > sheetsAllCount) { return(false); } } return(false); }