0
votes

I am writing a program in C# using the Excel 12 Interop and my program throws the HRESULT 0x800A03EC exception when I run it on a windows xp machine with Microsoft Office 2003 installed.

My development machine has Windows 7 64bit and Microsoft Office 2007, the program works fine.

My SaveAs code is as such:

      wbk.SaveAs(path, Excel.XlFileFormat.xlExcel8, 
                   Type.Missing, 
                   Type.Missing,
                   Type.Missing,
                   Type.Missing,
                   Excel.XlSaveAsAccessMode.xlExclusive,
                   Type.Missing, 
                   Type.Missing, 
                   Type.Missing, 
                   Type.Missing, 
                   Type.Missing);

Is there any workarounds that I can utilize so I don't have to install Office 2007 on the machine running Windows XP?

UPDATE

I have installed the interop assemblies for Office 2007 and Office 2010 on the Windows XP machine, which is also 64bit and I still receive the same error. Could it be a permissions issue with the assembly?

1
I am getting this error on Windows XP x64, not on Windows 7.NexAddo
It is an Excel error, not a Windows error. Many more hits on this when you google "excel saveas error 1004". There isn't enough info in your question to help us help you narrow it down.Hans Passant

1 Answers

0
votes
  1. You can probably just recompile using the Office 2003 interop, although that's .NET 1.1 and (I think) only available through the Office 2003 installer - look for ".NET Automation Support" or similar under each application. I have seen problems using code built for .NET 1.1 in 2+, though, particularly constructors failing - but completely repeatably, so if it works then there's no problem.

  2. You can use the Excel COM object directly. The result should then work for Excel 7 and later. The function signatures are broadly the same, although you now need to cast all the enums into integers to pass into the functions.

  3. If you're just using Excel to create a simple spreadsheet (or a relatively simple one) you could skip Excel altogether and use one of these libraries to generate the spreadsheet instead.