title: Save password protected Excel file to XML in C# (I know the password)
body: <p>I have a password protected XLS (the data is not protected the the adding of columns is disabled). This is the code:</p>
  
  <pre><code> _excelApp.DisplayAlerts = false;
              _excelApp.Visible = false;
  
              //opens
              workBook = _excelApp.Workbooks.Open(InputDirectory + CharacterFileName,
                  Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                  Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                  Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                  Type.Missing, Type.Missing);
  
              workBook.Password = "0000";
  
              //save
              workBook.SaveAs(OutputDirectoryFileName, XlFileFormat.xlXMLSpreadsheet,
                  "0000", Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange,
                  Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
  </code></pre>
  
  <p>The password is "0000". How can I make this code work? I tried setting the password but it refuses to save as XML (ERROR)</p>
  
  <p>The error is in french since I'm using french .NET " Le classeur que vous essayez d'enregistrer est protégé par mot de passe. Les classeurs protégés par mot de passe ne peuvent pas être enregistrés dans une feuille de calcul XML. Pour enregistrer ce fichier sous forme de feuille de calcul XML, vous devez d'abord supprimer le mot de passe."</p>
  
  <p>Any help? Thanks</p>