I am starting in the world of programming, and I have made a simple application, which is composed of a combobox (called cmbItemsEquipos), and when using the reference in excel to save the XLS file, I throw error.
String NameFile = String.Format("ClientesNoagregadosClaimPos{0}.xls", DateTime.Now.ToString("yyyymmddhhh"));
xlWorkBook.SaveAs(string.Format("C:\{0}-{1}", cmbItemsEquipos.SelectedText, NameFile), Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
and the following error is thrown at me:
Unhandled exception of type 'System.Runtime.InteropServices.COMException' in ClaimPosCurrier.exe Additional information: Microsoft Excel can not access the file 'C: \'.
There may be several reasons:
• File name or path does not exist.
• Another program is using the file.
• The book you are trying to save has the same name as another book that is currently open.
Why is it? My purpose is to save the XLS file based on the item selected from the cmbItemsEquipment ... **
Greetings.