是什么引起“自动化错误未指定错误”?在Worksheet_Activate上? [英] What is causing "Automation error Unspecified error" on Worksheet_Activate?

查看:141
本文介绍了是什么引起“自动化错误未指定错误”?在Worksheet_Activate上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为日期的工作表(对象名称为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

Visual Basic for Applications


  • Microsoft Excel 12.0对象库

  • OLE自动化

  • Microsoft Office 12.0对象库

  • Microsoft脚本运行时

  • Microsoft Forms 2.0对象运行时

  • Microsoft HTML对象库

  • Microsoft Internet控件

  • Microsoft ActiveX数据对象2.8库

  • Microsoft ActiveX数据对象记录集2.8库

  • Microsoft Excel 12.0 Object Library
  • OLE Automation
  • Microsoft Office 12.0 Object Library
  • Microsoft Scripting Runtime
  • Microsoft Forms 2.0 Object Runtime
  • Microsoft HTML Object Library
  • Microsoft Internet Controls
  • Microsoft ActiveX Data Objects 2.8 Library
  • Microsoft ActiveX Data Objects Recordset 2.8 Library

推荐答案

我发现了问题。我的一个窗体上有一个控件,该控件显然已停止工作,并且产生了连锁反应。

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,版本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屋!

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