We are experiencing a production issue whereby we call an Excel Workbook's SaveAs
method with a password. The exception thrown is:
The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
The call is done as follows, where _ExcelPassword
is the workbook's generated password and ExcelOutputPath
is the location on disk the file should be written to:
workbook.SaveAs(ExcelOutputPath, XlFileFormat.xlOpenXMLWorkbook, _ExcelPassword, _ExcelPassword, false, false);
There is no issue if the file is saved without a password though.
What am I missing please?
So the solution I ended up with was to save the workbook without a password, reopen it again, set the password on the workbook object and then save it again. Tedious, I know, but that completely fixed the remote procedure call failed
issue I was getting