Excel 2007 Automation under Windows Server 2008 x64

Today I’ve run into the strange problem. I developing a windows service which should generate an Excel files. I’ve tested it’s logic using unit tests and all worked fine.

But then I started testing for the windows service, I saw the following strange error:

Exception from HRESULT: 0x800A03EC ---< Exception trace >--- at Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout, Object Local) Exception from HRESULT: 0x800A03EC ---< Exception trace >---

So my windows service was unable to save Excel file.

I’ve checked “Allow service to interact with desktop” option, but the problem was still there…

After some time of googling I’ve found greate&simple solution in H Ogawa’s post. Hurrah!! This guy saved a lot of time for me! Thanks a lot! :)

Just in case you need it here is a solution:

Windows 2008 Server x64
Please create the following folder:

Windows 2008 Server x86
Please create the following folder: