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

雨燕双飞 提交于 2019-12-04 12:55:17

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).

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)

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.

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