什么导致“自动化错误未指定错误"?在 Worksheet_Activate 上? [英] What is causing "Automation error Unspecified error" on Worksheet_Activate?
问题描述
我有一个名为Dates"(对象名称为 A_Dates)的工作表,需要在激活时进行计算(可能值得注意的是,这在我的个人宏工作簿中).我经常打开工作簿,其中有太多的计算,我无法进行自动计算.所以我将自动计算设置为手动,并在工作表中添加以下代码:
I have a worksheet named "Dates" (object name is A_Dates) that needs to be calculated when it is activated (It may be worth noting that this is in my Personal macro workbook). I regularly have workbooks open that have too many calculations in the for me to have auto-calculation on. So I have auto-calc set to manual, and the following code in the worksheet:
Private Sub Worksheet_Activate()
A_Dates.Calculate
End Sub
这在过去 3 个月中日复一日地运行良好.昨天,它停止工作.它现在在声明行上抛出这个错误:
This has worked fine for the last 3 months, day-in and day-out. Yesterday, it stopped working. It now throws this error on the declaration line:
Microsoft Visual Basic
Automation error
Unspecified error
[OK] [Help]
我尝试更改我引用工作表的方式,使用:
I have tried changing how I reference the sheet, using:
Sheets("Dates").Calculate
和
ActiveSheet.Calculate
无济于事.我还包括错误处理:
to no avail. I've also included error handling:
On Error Resume Next
这并不能阻止它.我什至走了这么远:
which doesn't prevent it. I've even gone so far as:
Private Sub Worksheet_Activate()
On Error GoTo headache
Sheets("Dates").Calculate
Exit Sub
headache:
Exit Sub
End Sub
它仍然出现.我完全不知所措.有帮助吗?
and it still shows up. I am totally at a loss. Help?
我有以下参考资料,并在本工作簿的各种宏中使用了所有这些参考资料:
I have the following references, and use all of them in various macros in this workbook:
Visual Basic for Applications
Visual Basic for Applications
- Microsoft Excel 12.0 对象库
- OLE 自动化
- Microsoft Office 12.0 对象库
- 微软脚本运行时
- Microsoft Forms 2.0 对象运行时
- 微软 HTML 对象库
- 微软互联网控制
- Microsoft ActiveX 数据对象 2.8 库
- Microsoft ActiveX 数据对象记录集 2.8 库
推荐答案
我发现了这个问题.我的一个表单上的控件显然停止工作,这产生了连锁反应.
I found the issue. One of my forms had a control on it that apparently stopped working, and this had a ripple effect.
有问题的控件是Microsoft ProgressBar Control, version 6.0".我不知道为什么它停止工作,但删除表单(当然还有所有对它的引用)解决了这个问题.
The control in question was "Microsoft ProgressBar Control, version 6.0". I do not know WHY it stopped working, but removing the form (and, of course, all references to it) resolved the issue.
这篇关于什么导致“自动化错误未指定错误"?在 Worksheet_Activate 上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!