System.Runtime.InteropServices.COMException (0x800A03EC)
I was seeing this same error when trying to save an excel file. The code worked fine when I was using MS Office 2003, but after upgrading to MS Office 2007 I started seeing this. It would happen anytime I tried to save an Excel file to a server or remote fie share.
My solution, though rudimentary, worked well. I just had the program save the file locally, like to the user's C:\ drive. Then use the "System.IO.File.Copy(File, Destination, Overwrite)" method to move the file to the server. Then you can delete the file on the C:\ drive.
Works great, and simple. But admittedly not the most elegant approach.
Hope this helps! I was having a ton of trouble finding any solutions on the web till this idea popped into my head.
Try this as it worked for me...
- Go to "Start" -> "Run" and enter "dcomcnfg"
- This will bring up the component services window, expand out "Console Root" -> "Computers" -> "DCOM Config"
- Find "Microsoft Excel Application" in the list of components.
- Right click on the entry and select "Properties"
- Go to the "Identity" tab on the properties dialog.
- Select "The interactive user."
courtesy of Last paragraph mentioned in here
Some googling reveals that potentially you've got a corrupt file:
http://bitterolives.blogspot.com/2009/03/excel-interop-comexception-hresult.html
and that you can tell excel to open it anyway with the CorruptLoad parameter, with something like...
Workbook workbook = excelApplicationObject.Workbooks.Open(path, CorruptLoad: true);
Found Answer.......!!!!!!!
Officially Microsoft Office 2003 Interop is not supported on Windows server 2008 by Microsoft.
But after a lot of permutations & combinations with the code and search, we came across one solution which works for our scenario.
The solution is to plug the difference between the way Windows 2003 and 2008 maintains its folder structure, because Office Interop depends on the desktop folder for file open/save intermediately. The 2003 system houses the desktop folder under systemprofile which is absent in 2008.
So when we create this folder on 2008 under the respective hierarchy as indicated below; the office Interop is able to save the file as required. This Desktop folder is required to be created under
C:\Windows\System32\config\systemprofile
AND
C:\Windows\SysWOW64\config\systemprofile
This worked for me...
Also do check if .NET 1.1 is installed because its needed by Interop and ot preinstalled by Windows Server 2008
Or you can also Use SaveCopyas() method ist just take onargument as filename string)
Thanks Guys..!