Windows 7 .net Excel .SaveAs() Error Exception from HRESULT: 0x800A03EC

Note: This needs to be condensed a bit as it’s a compilation of all the fixes I’ve been making on our internal wiki but I’m not sure what subset of changes made it work so I’ll include it all.

Solution:

The following changes may be a superset of how to address this problem.

-Run DCOMCNFG.exe and navigate to ‘Component Services>Computers>My Computer’.
-Right click ‘My Computer’ and click ‘Properties’.
-Open the ‘COM Security’ tab. Add your account for everyone of the buttons listed (‘Edit Limits…’ and ‘Edit Default…’ buttons under ‘Access Permission’ & ‘Launch and Activate Permissions’). Give your account all access options. Click ‘Apply’ then ‘OK’.
-While still in DCOMCNFG expand the ‘My Computer’ link and open the ‘DCOM Config’ folder.
-Right click on ‘Microsoft Excel Application’ and select ‘Properties’.
-Under the ‘Security’ tab choose the ‘Customize’ option for ‘Launch and Activation Permissions’ and ‘Configuration Permissions’. For both click the ‘Edit…’ button. Give your account access to everything.
-While still in the ‘Properties’ for ‘Microsoft Excel Application’ go to the ‘Identity’ tab.
-Select the ‘The Interactive User’ option.
-Click ‘Apply’ then ‘OK’.
-Restart your computer.

-Try the below DCOMCNFG & ApplicationPoolIdentity change.

-Run command prompt as Administrator.
-Navigate to c:\Windows\System32\inetsrv> and run ‘appcmd set config -section:asp -enableParentPaths:true’

Alternately you could use .SaveCopyAs() although this may still not address the problem and will require code changes.

DCOMCNFG For windows 7:

This error happens on ‘Excel app = New Application();’ calls

This link details how to fix the problem for XP/Server 2003 but can be adapted to Windows 7: http://blog.crowe.co.nz/archive/2006/03/02/589.aspx

I do not have/could not find an ‘ASPNET’ account. You have to check the application pool to find out what the app is running as.
To do that go into ‘Computer Management>Services and Applications>Internet Information Services>Application Pools’
Right click on the appropriate AppPool and choose ‘Advanced Settings’. Under ‘Process Model>Identity’ you can find the account it is running under. Mine was ‘ApplicationPoolIdentity’ which I also couldn’t find so I changed it to ‘Network Service’ like Windows Server 2003.
Once this is set run DCOMCNFG.exe. Navigate to ‘Component Services>Computers>My Computer>DCOM Config’.
Find and right-click on ‘Microsoft Excel Application’ and select ‘Properties’.
Choose the ‘Security’ tab. Under ‘Launch and Activation Permissions’ choose ‘Customize’ and click ‘Edit’.
Then click the ‘Add…’ button.
Type the name of the the appropriate account, in this case ‘Network Service’ and click ‘Check Names’. Then click ‘OK’.
Back on the ‘Launch and Activation Permissions’ page highlight the ‘Network Service’ account and check the ‘Local Launch’ and ‘Local Activation’ check boxes. Then click ‘OK’.

Leave a Comment