I'm saving an excel file using SaveAs method in c#. but it shows error like :
Additional information: The file could not be accessed. Try one of the following:
• Make sure the specified folder exists.
• Make sure the folder that contains the file is not read-only.
• Make sure the file name does not contain any of the following characters: < > ? [ ] : | or *
• Make sure the file/path name doesn't contain more than 218 characters.
my code is this :
string savepath = AppDomain.CurrentDomain.BaseDirectory + @"\Salary Slips\a.xlsx";
xlwbOP.SaveAs(savepath, Excel.XlFileFormat.xlExcel12);
the savepath variable have value savepath="D:\Application\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Salary Slips\a.xlsx"
and the directory :"D:\Application\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Salary Slips\" is exsits