Intermittent HRESULT: 0x800A03EC errors during Excel SaveAs in .NET 2.0 app

╄→гoц情女王★ 提交于 2019-12-11 02:23:53

问题


I have a VB.NET 2.0 executable which I use to create numerous Excel files on a daily basis. Up until this point, it has been running on an XP box with Office 2007 installed (and using the Office 2007 Interop). It has worked fine for years.

Recently, the box failed and it was upgraded to a Windows 7 box, also running Office 2007. After that, I started getting intermittent errors during SaveAs functions at random points in the code.

What this means is that SOMETIMES the error doesn't happen at all. The code runs just fine. But SOMETIMES it happens on (for example) the 20th file that it's trying to SaveAs (there are many files containing multiple different types of data which are created by multiple loops). And then SOMETIMES it happens on (for example) the 50th file.

It's completely random in pretty much every way. I can't seem to track it down.

I've tried a few solutions, including the one found here: System.Runtime.InteropServices.COMException (0x800A03EC)

...even though that answer is for Office Interop 2003 (not 2007). I've also tried getting rid of the file extension in the Filename path (that was a suggestion from another site). The only other argument I use in the SaveAs function is the FileFormat (which I set to Excel8). I've seen some posts about security issues, but I don't see how this could be a security issue since it doesn't happen every time. I'm really at a loss for what could possibly be causing this. The code hasn't been changed since the XP box. The ONLY difference in this scenario is the O/S that the code is running on (and the fact that the new box is 64-bit).

WATYF

来源:https://stackoverflow.com/questions/17836610/intermittent-hresult-0x800a03ec-errors-during-excel-saveas-in-net-2-0-app

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