public void RefreshWorksheet() { if (mathcadWorksheet != null) { mathcadWorksheet.Close(MCSaveOption.mcDiscardChanges); } mathcadWorksheet = mathcadWorksheets.Open(mathcadFilePath); Recalculate(); if (mathcadWorksheet == null) { throw new ApplicationException("Failed to initialize Mathcad 15 worksheet"); } }