的ErrorMessage在Excel中 [英] ErrorMessage in Excel

查看:505
本文介绍了的ErrorMessage在Excel中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了以下错误急需解决的问题,而设置的Excel ApplicationClass的假将DisplayAlerts属性。

i got a urgent problem with the following error, while setting the DisplayAlerts-property of the Excel ApplicationClass to false.

var excel = new Excel.Application();
excel.DisplayAlerts = false;



我得到在日志中出现以下错误信息:

I get the following error message in the logs:

System.Runtime.InteropServices.COMException (0x800AC472): Exception from HRESULT: 0x800AC472
     at Microsoft.Office.Interop.Excel.ApplicationClass.set_DisplayAlerts(Boolean RHS)
     at Service.Dispose()

下面的MessageBox显示

The following MessageBox is shown

在这种情况下,任何想法?

Any ideas on this case?

问候
的MacX

Regards MacX

推荐答案

您必须赶上这个错误并重新提交无论你是插入的Excel单元格。这是一个恼人的错误,我一直没能实现和优雅的解决方案。

You'll have to catch that error and re-submit whatever you were inserting into a cell on excel. This is an annoying bug and I have not been able to implement and elegant solution for.

有人可以纠正我,如果我错了,但我不能找到一种方法来确定是否Excel是处于悬浮状态,或者不醒目,除了这个例外。这就像一个不可避免的竞争条件,你不知道结果,直到你知道结果。我搜索的方式放弃之前解决这个并实现了一个丑陋的错误检查解决方案。

Someone can correct me if I am wrong but I cannot find a way to determine if Excel is in a "suspended" state or not besides catching this exception. It's like an unavoidable race condition where you don't know the result until you know the result. I searched for a way to solve this before giving up and implemented an ugly error checking solution.

对不起,我希望有人对这个比我更好的解决方案。

Sorry, I hope someone has a better solution for this than me.

这篇关于的ErrorMessage在Excel中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆