title: writing to disk: File access denied
body: <p>I try to write my data to an Excel file. I'm using workbook method SaveAs. This is the code:</p>
  
  <pre><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);
  </code></pre>
  
  <p>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:</p>
  
  <blockquote>
    <p>File access denied". </p>
  </blockquote>
  
  <p>What's wrong? Does anybody know how this can be avoided? </p>