无法设置Application类的DisplayAlerts属性 [英] Unable to set the DisplayAlerts property of the Application class

查看:1009
本文介绍了无法设置Application类的DisplayAlerts属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我间歇地得到以下异常:

I am intermittently getting the following exception:

如果我浏览代码,并且我无法找出如何可靠地重现它,就不会发生。内部异常是null。

It does not occur if I step through the code and I'm having trouble working out how to reproduce it reliably. The inner exception is null.

我在网上搜索,发现一个C ++ MFC程序员的摄像头,但没有答案:
http://www.excelforum.com/excel-programming/555121 -unable-to-set-displayalerts-property.html

I have search the web and found a C++ MFC programmer cam across the same thing but no answers: http://www.excelforum.com/excel-programming/555121-unable-to-set-displayalerts-property.html

我也已经阅读了另一个可能的原因,不幸的是与打开一个电子表格通过IE。

I also have read up on another possible cause unfortunately is unrelated as its to do with opening a spreadsheet via IE.


有人可以看看这里发生了什么吗?我会很多
喜欢知道根本原因和代码,而不是使用
try-catch。感谢任何建议。

Can someone please shed light on what is going on here? I would much prefer to know the root cause and code around it rather than using a try-catch. Thanks for any advice.

ps我没有写这个代码(如果我这样做,会有一个bool参数为true false) ,我只是这个项目的新手,想要清理它,使其更加健壮。

ps I didn't write this code (there would be a bool parameter for true false if I did), I'm just new to this project and want to clean it up a bit and make it more robust.

推荐答案

你需要添加异常处理来捕获和报告ErrorCode,如故障排除提示中所建议的,然后确定Excel正在抱怨的内容。

You need to add exception handling to capture and report the ErrorCode, as suggested in the troubleshooting tips, then determine what Excel is complaining about.

这可能是由许多不同的问题引起的,但没有ErrorCode,你在黑暗中飞翔。一旦你找出了ErrorCode,如果它是无害的,你可以捕获异常并忽略它。

This could be caused by a number of different issues, but without the ErrorCode, you are flying in the dark. Once you figure out the ErrorCode, if it is innocuous you could just trap the exception and ignore it.

十六进制错误代码返回在 COMException 。我不知道该信息是否在您提供的列表中,但是肯定不会伤害到。

The hex error code is returned in the ErrorCode property of the COMException that is thrown in this case. I'm not sure if the message will be in that list you provided, but it certainly doesn't hurt to look there.

这篇关于无法设置Application类的DisplayAlerts属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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