由于 Office Service Pack 3.0 导致的 Excel/VBA 自动化错误由 Forms 引起
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11971358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Excel/VBA Automation Errors due to Office Service Pack 3.0 caused by Forms
提问by Rob
After installing all latest windows updates my Excel VBA code is showing an automation error at the very start of the first module. It contains some forms as well as numerous modules of VBA code. However, when removing the forms (and associated code) everything is fine.
安装所有最新的 Windows 更新后,我的 Excel VBA 代码在第一个模块开始时显示自动化错误。它包含一些表单以及大量的 VBA 代码模块。但是,当删除表单(和相关代码)时,一切都很好。
The same thing happened about a year ago after some other windows updates. Back then deleting the .exd files did the trick, but the current updates (including Service Pack 3) seem to be different.
大约一年前,在其他一些 Windows 更新之后,也发生了同样的事情。当时删除 .exd 文件确实有效,但当前的更新(包括 Service Pack 3)似乎有所不同。
What is going on and how can I get the forms to work? All the code is unchanged and has survived all previous windows/office updates. Running Windows 7 (same happening on Vista machine) and Office 2007.
这是怎么回事,我怎样才能让表格发挥作用?所有代码都没有改变,并且在所有以前的 windows/office 更新中幸存下来。运行 Windows 7(在 Vista 机器上也是如此)和 Office 2007。
回答by ray
I used to see this a lot with Visual Basic and Crystal Reports; either due to a bad deployment or DLL Hell.
我曾经在Visual Basic 和 Crystal Reports 中经常看到这种情况;由于部署不当或DLL Hell。
So, my guess is that it's not the code but perhaps some 3rd party controls (OCXs, DLLs) you're using.
所以,我的猜测是它不是代码,而是您正在使用的某些 3rd 方控件(OCX、DLL)。
Check your References (In VBA IDE, click Tools and References) and to see where each DLL is pointing.
检查您的引用(在 VBA IDE 中,单击工具和引用)并查看每个 DLL 指向的位置。
See if any of the dates on the libraries are different than a working machine and you may find the culprit.
查看图书馆上的任何日期是否与工作机器不同,您可能会找到罪魁祸首。
Edit
编辑
The OP found the problem by following the steps above.
OP 按照上述步骤发现了问题。
The fix for this particular issue is to unregister mscomctl.ocx:
此特定问题的解决方法是取消注册 mscomctl.ocx:
regsvr32 /u mscomctl.ocx
Then register it:
然后注册它:
regsvr32 mscomctl.ocx
回答by Micha Kaufman
Same issue here, problem completely solved after registering mscomctl.ocx!
同样的问题,注册mscomctl.ocx后问题完全解决!
for Windows 7 or 2008 - remember to run cmd.exe "as administrator", and then:
对于 Windows 7 或 2008 - 请记住以“管理员身份”运行 cmd.exe,然后:
for 32bit Windows systems: regsvr32 c:\windows\system32\mscomctl.ocx
对于 32 位 Windows 系统:regsvr32 c:\windows\system32\mscomctl.ocx
for 64bit Windows systems: regsvr32 c:\windows\syswow64\mscomctl.ocx
对于 64 位 Windows 系统:regsvr32 c:\windows\syswow64\mscomctl.ocx
回答by Aaron
Same issue with VBA for AutoCAD. In my case, registering the new mscomctl.ocx with regsvr32 was enough to fix the issue.
与 VBA for AutoCAD 相同的问题。就我而言,使用 regsvr32 注册新的 mscomctl.ocx 足以解决问题。
回答by Sebastian Fernandez
We couldn′t solve the problem by re-registering mscomctl.ocx. But we solved it by removing a "progress bar object form" wich calls mscomctl.ocx... We replaced it with application.statusbar.
重新注册mscomctl.ocx无法解决问题。但是我们通过删除一个名为 mscomctl.ocx 的“进度条对象表单”解决了这个问题……我们用 application.statusbar 替换了它。
回答by Avi
Check out http://support.microsoft.com/kb/2687441for an update that may fix this problem
查看http://support.microsoft.com/kb/2687441以获取可能解决此问题的更新
回答by Marc
Had the same issue on all of our terminal servers after one of the updates last night. Registering mscomctl.ocx fixed the problem for all users.
在昨晚进行了一次更新后,我们所有的终端服务器都出现了同样的问题。注册 mscomctl.ocx 解决了所有用户的问题。
回答by hrattink
Un- and registering the MSCOMCTL.ocx did the trick for me:
取消并注册 MSCOMCTL.ocx 对我有用:
Open an administrative-level command prompt. Click START, and type RUN in the run command line. On Windows Vista and Windows 7 you will see CMD.EXE appear in the quick search list. Right click CMD.EXE and left click Run As Administrator. A black command prompt opens.
If on a 64-bit machine, type the following: regsvr32.exe /u C:\Windows\SysWOW64\MSCOMCTL.OCX
Hit ENTER then type regsvr32.exe C:\Windows\SysWOW64\MSCOMCTL.OCX If on a 32-bit machine, type the following: regsvr32.exe /u C:\Windows\System32\MSCOMCTL.OCX hit ENTER then type
regsvr32.exe C:\Windows\System32\MSCOMCTL.OCX Your Office program should work again after doing this.
打开管理级别的命令提示符。单击 START,然后在运行命令行中键入 RUN。在 Windows Vista 和 Windows 7 上,您将看到 CMD.EXE 出现在快速搜索列表中。右键单击 CMD.EXE,然后左键单击以管理员身份运行。一个黑色的命令提示符打开。
如果在 64 位计算机上,请键入以下内容:regsvr32.exe /u C:\Windows\SysWOW64\MSCOMCTL.OCX
按 ENTER 然后键入 regsvr32.exe C:\Windows\SysWOW64\MSCOMCTL.OCX 如果在 32 位计算机上,请键入以下内容:regsvr32.exe /u C:\Windows\System32\MSCOMCTL.OCX 按 ENTER 然后键入
regsvr32。 exe C:\Windows\System32\MSCOMCTL.OCX 执行此操作后,您的 Office 程序应该会再次运行。
Please see also: http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2012/08/15/quot-unspecified-automation-error-quot-after-applying-ms12-060.aspx
另请参阅:http: //blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2012/08/15/quot-unspecified-automation-error-quot-after-applying-ms12-060.aspx
回答by Tom Pydeski
son of a gun...I re-registered C:\Windows\System32\MSCOMCTL.OCX and everything works again. Thanks so much to all that pointed that out.
枪的儿子......我重新注册了 C:\Windows\System32\MSCOMCTL.OCX 并且一切正常。非常感谢所有指出这一点的人。
回答by Corey
We have the same problem. In our Add-In, we were able to trace the problem to a declaration of a variable as Excel.Application. The reference to this object is in the Excel.exe file, so it is very unclear as to which files got messed up.
我们有同样的问题。在我们的加载项中,我们能够将问题追溯到变量声明为 Excel.Application。对该对象的引用在 Excel.exe 文件中,因此不清楚哪些文件被搞砸了。
The machines that have this problem were all updated early this morning (15 Aug 2012) with the following updates (sorry for not posting links, as a new user, I'm limited to only two per post):
有这个问题的机器都在今天早上(2012 年 8 月 15 日)更新了以下更新(抱歉没有发布链接,作为一个新用户,我每个帖子只限两个):
Security Update for Microsoft Office 2007 suites (KB2596615)
Microsoft Office 2007 套件的安全更新 (KB2596615)
Security Update for Microsoft Office 2007 suites (KB2596754)
Microsoft Office 2007 套件的安全更新 (KB2596754)
Security Update for Microsoft Office 2007 suites (KB2596856)
Microsoft Office 2007 套件的安全更新 (KB2596856)
Security Update for Microsoft Office 2007 suites (KB2687441)
Microsoft Office 2007 套件的安全更新 (KB2687441)
Update for Microsoft Office Outlook 2007 Junk Email Filter (KB2687400)
Microsoft Office Outlook 2007 垃圾邮件过滤器更新 (KB2687400)
Windows Malicious Software Removal Tool x64 - August 2012 (KB890830)
Windows 恶意软件删除工具 x64 - 2012 年 8 月 (KB890830)
At present, we have not found any information on the MSDN site that could clear this up. We're still trying to isolate this down further.
目前,我们还没有在 MSDN 站点上找到任何可以解决此问题的信息。我们仍在尝试进一步隔离这一点。
回答by Tom Pydeski
I had the same problem. I got an unspecified error opening excel with my Add-In loading.
In the past, deleting the *.exd files in C:\Documents and Settings\%USERNAME%\Application Data\Microsoft\Forms\
did the trick, but not this time.
When I attempted to open up the forms in my addin, I got a different error and I could not open the forms.
I ended up rolling back to last night prior to the update and everything works again.
我有同样的问题。我的加载项加载打开 excel 时出现未指明的错误。过去,删除 C:\Documents and Settings\%USERNAME%\Application Data\Microsoft\Forms\ 中的 *.exd 文件可以解决问题,但这次不行。
当我试图在我的插件中打开表单时,我遇到了一个不同的错误,我无法打开这些表单。我最终回滚到更新前的昨晚,一切又恢复正常。