Excel Programming: Exception from HRESULT: 0x800A03EC. at Microsoft.office.Interop

旧街凉风 提交于 2019-12-06 06:48:09

问题


I have created a small application which opens,reads and creates Excel files. The app has been written in C# and I don't know why I get this error message when the application is running in one computer. I have run the same applicaiton on my computer and I don't have any problem.

Can somebody help me and let me know why happen this error?

thanks


回答1:


First of all, I suspect the HRESULT was really 0x800A03EC (it's kinda important to communicate the exact number if you are talking error codes ;-)).

What this error usually means is that one or more formula contains an error. The main reason for a formula working on one machine and not on others is usually "locale": check if that machine has different formatting settings for numbers, dates and/or currencies (comma v.s. period, etc).




回答2:


Another reason could be mine - too early date is exporting; Excel has limitations (http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP005199291.aspx)




回答3:


Another possibility could be that Excel is reading the value your putting in as an actual formula (i.e. it expects to need to calculate to get the cell value) as opposed to just the value.

For example, if you have your script attempt to set a cell to "====Fake Note by: fakeuser 6/23/14 14:41", then it will throw the error. To get around this, check the value's left-most character to see if it's "=", "+", "-", "/", or "*". If it is, simply add a space as the first character and the text will be added correctly.



来源:https://stackoverflow.com/questions/493178/excel-programming-exception-from-hresult-0x800a03ec-at-microsoft-office-inter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!