private void ServicesForm_FormClosing(object sender, FormClosingEventArgs e) { if ((user.GetType() == typeof(Administration))) { Administration admin = (Administration)user; ExcelService excel = new ExcelService(); string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Information System For Car Service\\Information System.xls"; if (excel.ExcelIsPresent()) { if (File.Exists(path)) { excel.OpenDocument(path); } else { excel.NewDocument(); } FillService(); excel.WriteServiceList(service); excel.CloseDocument(); } } }