I try to write my data to an Excel file. I'm using workbook method SaveAs. This is the code:
string FN = "C:\\Users\\Documents\\dane1.xlsx";
WB.SaveAs(FN, Excel.XlFileFormat.xlWorkbookNormal,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Excel.XlSaveAsAccessMode.xlShared,
Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value);
Everything is OK while the first parameter is hardcoded. When I try use a reference to object where I'm keeping path and file name (I've got it from SaveFileDialog) my application return me an exception:
File access denied".
What's wrong? Does anybody know how this can be avoided?