Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In my Windows service,I have exported the data from database into excel using Interop Excel.
An exception is thrown when i try to save the exported excel using SaveAs or SaveCopyAs.

The exception says: Exception from HRESULT: 0x800A03EC

I have used the following code:

C#
string filename;
filename ="C://Test.test.xlsx";
excelWorkbook.SaveCopyAs(filename);



Is there any issue if COM objects are used in Windows Service??


Thanks
Posted
Updated 17-Feb-11 18:03pm
v2
Comments
Sunasara Imdadhusen 18-Feb-11 0:03am    
Added codding format

Make sure you have write permissions to the appropriate folder.
 
Share this answer
 
Make sure the file you want to override is not opened in excel (or any other application). And (Abhinav mentioned it) have a look on your permissions. And make sure you reference the correct office version in your project (a mistake that gave me the same error...) - only if you have multiple office versions installed.
 
Share this answer
 
Try this way:
string filename = Environment.CurrentDirectory + "\\test.xlsx";
excelWorkbook.SaveCopyAs(filename);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900