2010-06-25

InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file

I've been working on a problem for the past half a day with the MS Office 2007 PIA.  The issue is with MS Office automation on Windows Server 2008 (x64).

This statement fails:

                wb = (Excel._Workbook)(books.Open(_sourceFilename, 0, true, missing, missing,
                                                 missing, true, missing, missing, missing, missing,
                                                 missing, missing, missing, missing));
with error:
System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file ''. There are several possible reasons:

• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
   at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
The solution is an odd one: create the directory "C:\Windows\SysWOW64\config\systemprofile\Desktop".

That's it.  Works like a charm.

27 comments:

  1. For 32 bit systems create the following directory
    C:\Windows\System32\config\systemprofile\Desktop

    ReplyDelete
  2. it works fine for me!! Thanks!!

    ReplyDelete
  3. I'm very very thank you.
    You solve my problem.
    Thanks again.

    Merry Christmas.
    Happy New Year

    ReplyDelete
  4. Replies
    1. I'd like to know why also? does anyone know?

      Delete
  5. Thanks I was able to open the excel work book .Earlier it was giving this error. But how did it work ???


    I got another error
    -The remote procedure call failed. (Exception from HRESULT: 0x800706BE)

    Please Help

    ReplyDelete
    Replies
    1. Hi, i have the same issue, did you solve it?

      Thanks in advance

      Delete
  6. Additionally, you may need to grant the account that whatever your system is running as full control to that folder. We had a windows service account that was trying to access that folder and this didn't work until we granted the service account full control to that folder.

    ReplyDelete
  7. HI, I have had the same problem on the follow scenario: WINDOWS 7 64bit, Office 2010 32bit. With a consele application that call an instance of excel I obtain the same error. I follow your suggest and now is ok. I would to know why Excel on this scanario need of DESKTOP folder. Please it is form me very important.

    ReplyDelete
  8. Ty i dont know what i did but it works!!!

    ReplyDelete
  9. Great!!!! It works, but how did you figure it out in the first place. It makes not logical sense. :-)

    ReplyDelete
  10. thnx a lot
    it works fine.......
    its magic....:)

    ReplyDelete
  11. I can't believe this actually fixes the issue!
    Thanks!!!

    ReplyDelete
  12. OMG !!! Great !!!!! Thanks a lot !!!!!! It works for me !!! Thanks Thanks !!!! (I have lost 1 week for this bug)

    ReplyDelete
  13. I would love to know WHY this works but the fact that it works at all is enough for now :)

    Thanks

    ReplyDelete
  14. This is still working! :)
    Thanks!

    ReplyDelete
  15. It is now the end of 2015... and this still works. I only got this error after publishing to a new server. I tried the index remedy, permissions issues, even tried to place the file locally on the new server. Nada. but this damn folder solved my issue and now I can roll out my software to the team! Thank you so much! (no seriously, if I could hug you I would)

    ReplyDelete
  16. I am still getting this error. Created Desktop folder as said, given all permissions. I am on Windows Server 2012

    ReplyDelete
  17. Its June 2016, I have the same problem, and created the Desktop directory, but didn't solve the problem. Do I need a reboot?
    Using Windows10, 64-bit. Excel 2013
    My Microsoft.Office.Interop.Excel dll is pretty old v2.0.50727 (Jan 18,2011), but has worked in May 2016. Just stopped working last week.

    Any insight would be appreciated

    ReplyDelete
  18. Thank you so much.....It worked like charm...Many thanks

    ReplyDelete