public static bool EvaluateRibbonDisplay(IQuestion question, string filename, ShowHide display) { ExcelInterop.Application excelApplication = null; try { excelApplication = new ExcelInterop.Application() { Visible = false, DisplayAlerts = false, ScreenUpdating = false }; ExcelInterop.Workbook excelWorkbook = excelApplication.Workbooks.Open(filename); bool result = false; var abc = excelApplication.ExecuteExcel4Macro("Get.ToolBar(7,\"Ribbon\")"); \\always returing true var abcd = excelApplication.CommandBars["Get.ToolBar(7,\"Ribbon\")"].Enabled;\\always returing true if (excelApplication.ExecuteExcel4Macro("Get.ToolBar(7,\"Ribbon\")") == Convert.ToBoolean(EnumStringExtension.GetDescription(display))) result = true; excelWorkbook.Close(); return result; } catch (Exception) { return false; } finally { QuitApplication(excelApplication); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)