vba Microsoft Excel ActiveX 控件被禁用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27411399/
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
Microsoft Excel ActiveX Controls Disabled?
提问by Mike Pedersen
I have some Excel worksheets that use ActiveX checkboxes to control certain activity. They worked recently but today started to give errors. I was alerted to this by a colleague, but it was still working on my computer. I checked his version of Excel against mine and his was newer. I noticed there were new Windows updates, so I did the update. After I applied pending updates, it now no longer works on my computer. I cannot check the ActiveX checkboxes any longer, and, as a part of trying to debug, it appears I cannot even add an ActiveX control to any worksheet, even a new worksheet, any more. I get an error dialog that says, "Cannot insert object." (I can still add form controls, just not ActiveX.) Anyone else experiencing this after a recent update? Any suggestions?
我有一些使用 ActiveX 复选框来控制某些活动的 Excel 工作表。他们最近工作,但今天开始出现错误。一位同事提醒我这件事,但它仍在我的电脑上工作。我检查了他的 Excel 版本和我的版本,他的版本较新。我注意到有新的 Windows 更新,所以我做了更新。在我应用待处理的更新后,它现在不再适用于我的计算机。我无法再检查 ActiveX 复选框,并且作为尝试调试的一部分,看来我什至无法将 ActiveX 控件添加到任何工作表,甚至是新工作表。我收到一个错误对话框,提示“无法插入对象”。(我仍然可以添加表单控件,只是不能添加 ActiveX。)最近更新后还有其他人遇到过这种情况吗?有什么建议?
Thanks,
谢谢,
Mike
麦克风
回答by John W.
From other forums, I have learned that it is due to the MS Update and that a good fix is to simply delete the file MSForms.exd from any Temp subfolder in the user's profile. For instance:
从其他论坛,我了解到这是由于 MS 更新造成的,一个好的解决方法是简单地从用户配置文件中的任何 Temp 子文件夹中删除文件 MSForms.exd。例如:
C:\Users\[user.name]\AppData\Local\Temp\Excel8.0\MSForms.exd
C:\Users\[user.name]\AppData\Local\Temp\Excel8.0\MSForms.exd
C:\Users\[user.name]\AppData\Local\Temp\VBE\MSForms.exd
C:\Users\[user.name]\AppData\Local\Temp\VBE\MSForms.exd
C:\Users\[user.name]\AppData\Local\Temp\Word8.0\MSForms.exd
C:\Users\[user.name]\AppData\Local\Temp\Word8.0\MSForms.exd
Of course the application (Excel, Word...) must be closed in order to delete this file.
当然,必须关闭应用程序(Excel、Word...)才能删除此文件。
回答by Jan Moritz
Here is the best answer that I have found on the Microsoft Excel Support Team Blog
这是我在 Microsoft Excel 支持团队博客上找到的最佳答案
For some users, Forms Controls (FM20.dll) are no longer working as expected after installing December 2014 updates. Issues are experienced at times such as when they open files with existing VBA projects using forms controls, try to insert a forms control in to a new worksheet or run third party software that may use these components.
You may received errors such as:
"Cannot insert object" "Object library invalid or contains references to object definitions that could not be found"
Additionally, you may be unable to use or change properties of an ActiveX control on a worksheet or receive an error when trying to refer to an ActiveX control as a member of a worksheet via code. Steps to follow after the update:
To resolve this issue, you must delete the cached versions of the control type libraries (extender files) on the client computer. To do this, you must search your hard disk for files that have the ".exd" file name extension and delete all the .exd files that you find. These .exd files will be re-created automatically when you use the new controls the next time that you use VBA. These extender files will be under the user's profile and may also be in other locations, such as the following:
%appdata%\Microsoft\forms
%temp%\Excel8.0
%temp%\VBE
Scripting solution:
Because this problem may affect more than one machine, it is also possible to create a scripting solution to delete the EXD files and run the script as part of the logon process using a policy. The script you would need should contain the following lines and would need to be run for each USER as the .exd files are USER specific.
del %temp%\vbe\*.exd
del %temp%\excel8.0\*.exd
del %appdata%\microsoft\forms\*.exd
del %appdata%\microsoft\local\*.exd
del %appdata%\Roaming\microsoft\forms\*.exd
del %temp%\word8.0\*.exd
del %temp%\PPT11.0\*.exd
Additional step:
If the steps above do not resolve your issue, another step that can be tested (see warning below):
On a fully updated machine and after removing the .exd files, open the file in Excel with edit permissions.
Open Visual Basic for Applications > modify the project by adding a comment or edit of some kind to any code module > Debug > Compile VBAProject.
Save and reopen the file. Test for resolution. If resolved, provide this updated project to additional users.
Warning: If this step resolves your issue, be aware that after deploying this updated project to the other users, these users will also need to have the updates applied on their systems and .exd files removed as well.
If this does not resolve your issue, it may be a different issue and further troubleshooting may be necessary.
Microsoft is currently working on this issue. Watch the blog for updates.
对于某些用户,安装 2014 年 12 月更新后,表单控件 (FM20.dll) 不再按预期工作。有时会遇到问题,例如当他们使用表单控件打开包含现有 VBA 项目的文件、尝试将表单控件插入新工作表或运行可能使用这些组件的第三方软件时。
您可能会收到以下错误:
“无法插入对象”“对象库无效或包含对无法找到的对象定义的引用”
此外,您可能无法在工作表上使用或更改 ActiveX 控件的属性,或者在尝试通过代码将 ActiveX 控件引用为工作表成员时收到错误。 更新后的步骤:
要解决此问题,您必须删除客户端计算机上控件类型库(扩展器文件)的缓存版本。为此,您必须在硬盘上搜索具有“.exd”文件扩展名的文件,并删除找到的所有 .exd 文件。当您下次使用 VBA 时使用新控件时,将自动重新创建这些 .exd 文件。这些扩展文件将位于用户的配置文件下,也可能位于其他位置,例如:
%appdata%\Microsoft\forms
%temp%\Excel8.0
%temp%\VBE
脚本解决方案:
由于此问题可能会影响多台计算机,因此还可以创建脚本解决方案来删除 EXD 文件并使用策略将脚本作为登录过程的一部分运行。您需要的脚本应该包含以下几行,并且需要为每个用户运行,因为 .exd 文件是特定于用户的。
del %temp%\vbe\*.exd
del %temp%\excel8.0\*.exd
del %appdata%\microsoft\forms\*.exd
del %appdata%\microsoft\local\*.exd
del %appdata%\Roaming\microsoft\forms\*.exd
删除 %temp%\word8.0\*.exd
删除 %temp%\PPT11.0\*.exd
附加步骤:
如果上述步骤不能解决您的问题,则可以测试另一个步骤(请参阅下面的警告):
在完全更新的机器上,删除 .exd 文件后,使用编辑权限在 Excel 中打开该文件。
打开 Visual Basic for Applications > 通过向任何代码模块添加注释或某种编辑来修改项目 > 调试 > 编译 VBAProject。
保存并重新打开文件。测试分辨率。如果解决,请将此更新的项目提供给其他用户。
警告:如果此步骤解决了您的问题,请注意,在将此更新后的项目部署给其他用户后,这些用户还需要在其系统上应用更新并删除 .exd 文件。
如果这不能解决您的问题,则可能是另一个问题,可能需要进一步的故障排除。
Microsoft 目前正在处理此问题。观看博客以获取更新。
回答by Ron R
回答by Yi Hu
I'm an Excel developer, and I definitely felt the pain when this happened. Fortunately, I was able to find a workaround by renaming the MSForms.exd files in VBA even when Excel is running, which also can fix the issue. Excel developers who need to distribute their spreadsheets can add the following VBA code to their spreadsheets to make them immune to the MS update.
我是一名 Excel 开发人员,当发生这种情况时,我肯定感到痛苦。幸运的是,即使 Excel 正在运行,我也能够通过在 VBA 中重命名 MSForms.exd 文件来找到解决方法,这也可以解决问题。需要分发电子表格的 Excel 开发人员可以将以下 VBA 代码添加到他们的电子表格中,以使其不受 MS 更新的影响。
Place this code in any module.
将此代码放在任何模块中。
Public Sub RenameMSFormsFiles()
Const tempFileName As String = "MSForms - Copy.exd"
Const msFormsFileName As String = "MSForms.exd"
On Error Resume Next
'Try to rename the C:\Users\[user.name]\AppData\Local\Temp\Excel8.0\MSForms.exd file
RenameFile Environ("TEMP") & "\Excel8.0\" & msFormsFileName, Environ("TEMP") & "\Excel8.0\" & tempFileName
'Try to rename the C:\Users\[user.name]\AppData\Local\Temp\VBE\MSForms.exd file
RenameFile Environ("TEMP") & "\VBE\" & msFormsFileName, Environ("TEMP") & "\VBE\" & tempFileName
End Sub
Private Sub RenameFile(fromFilePath As String, toFilePath As String)
If CheckFileExist(fromFilePath) Then
DeleteFile toFilePath
Name fromFilePath As toFilePath
End If
End Sub
Private Function CheckFileExist(path As String) As Boolean
CheckFileExist = (Dir(path) <> "")
End Function
Private Sub DeleteFile(path As String)
If CheckFileExist(path) Then
SetAttr path, vbNormal
Kill path
End If
End Sub
The RenameMSFormsFiles subroutine tries to rename the MSForms.exd files in the C:\Users\[user.name]\AppData\Local\Temp\Excel8.0\and C:\Users\[user.name]\AppData\Local\Temp\VBE\folders to MSForms - Copy.exd.
RenameMSFormsFiles 子例程尝试将C:\Users\[user.name]\AppData\Local\Temp\Excel8.0\和C:\Users\[user.name]\AppData\Local\Temp\VBE\文件夹中的 MSForms.exd 文件重命名为 MSForms - Copy.exd。
Then call the RenameMSFormsFiles subroutine at the very beginning of the Workbook_Open event.
然后在 Workbook_Open 事件的最开始调用 RenameMSFormsFiles 子例程。
Private Sub Workbook_Open()
RenameMSFormsFiles
End Sub
The spreadsheet will try to rename the MSForms.exd files when it opens. Obviously, this is not a perfect fix:
电子表格将在打开时尝试重命名 MSForms.exd 文件。显然,这不是一个完美的解决方案:
- The affected user will still experience the ActiveX control errors when running the VBA code the very first time opening the spreadsheet. Only after executing the VBA code once and restarting Excel, the issue is fixed. Normally when a user encounters a broken spreadsheet, the knee-jerk reaction is to close Excel and try to open the spreadsheet again. :)
- The MSForms.exd files are renamed every time the spreadsheet opens, even when there's no issue with the MSForms.exd files. But the spreadsheet will work just fine.
- 受影响的用户在第一次打开电子表格时运行 VBA 代码时仍会遇到 ActiveX 控件错误。只有在执行一次 VBA 代码并重新启动 Excel 后,问题才能得到解决。通常,当用户遇到损坏的电子表格时,下意识的反应是关闭 Excel 并尝试再次打开电子表格。:)
- 每次打开电子表格时都会重命名 MSForms.exd 文件,即使 MSForms.exd 文件没有问题。但电子表格将工作得很好。
At least for now, Excel developers can continue to distribute their work with this workaround until Microsoft releases a fix.
至少目前,在 Microsoft 发布修复程序之前,Excel 开发人员可以继续使用此变通方法分发他们的工作。
I've posted this solution here.
我已经在这里发布了这个解决方案。
回答by Marc Thibault
With Windows 8.1 I couldn't find any .exd files using windows search. On the other hand, a cmd command dir *.exd /Sfound the one file on my system.
在 Windows 8.1 中,我无法使用 Windows 搜索找到任何 .exd 文件。另一方面,cmd 命令dir *.exd /S在我的系统上找到了一个文件。
回答by pghcpa
Advice in KB and above didn't work for me. I discovered that if one Excel 2007 user (with or without the security update; not sure of exact circumstances that cause this) saves the file, the original error returns.
KB 及以上的建议对我不起作用。我发现,如果一个 Excel 2007 用户(有或没有安全更新;不确定导致此问题的确切情况)保存文件,则会返回原始错误。
I discovered that the fastest way to repair the file again is to delete all the VBA code. Save. Then replace the VBA code (copy/paste). Save. Before attempting this, I delete the .EXD files first, because otherwise I get an error on open.
我发现再次修复文件的最快方法是删除所有 VBA 代码。节省。然后替换 VBA 代码(复制/粘贴)。节省。在尝试之前,我先删除 .EXD 文件,否则我会在打开时出错。
In my case, I cannot upgrade/update all users of my Excel file in various locations. Since the problem comes back after some users save the Excel file, I am going to have to replace the ActiveX control with something else.
就我而言,我无法在不同位置升级/更新我的 Excel 文件的所有用户。由于在某些用户保存 Excel 文件后问题又回来了,我将不得不用其他东西替换 ActiveX 控件。
回答by perry
Simplified instructions for end-users. Feel free to copy/paste the following.
面向最终用户的简化说明。随意复制/粘贴以下内容。
Here's how to fix the problem when it comes up:
出现问题时,解决方法如下:
- Close all your Office programs and files.
- Open Windows Explorer and type %TEMP% into the address bar, then press Enter. This will take you into the system temporary folder.
- Locate and delete the following folders: Excel8.0, VBE, Word8.0
- Now try to use your file again, it shouldn't have any problems.
- 关闭所有 Office 程序和文件。
- 打开 Windows 资源管理器并在地址栏中键入 %TEMP%,然后按 Enter。这将带您进入系统临时文件夹。
- 找到并删除以下文件夹:Excel8.0、VBE、Word8.0
- 现在尝试再次使用您的文件,它应该没有任何问题。
You might need to wait until the problem occurs in order for this fix to work. Applying it prematurely (before the Windows Update gets installed on your system) won't help.
您可能需要等到问题发生才能使此修复程序起作用。过早应用它(在系统上安装 Windows 更新之前)将无济于事。
回答by dePatinkin
The best source of information and updates on this issue I could find is in the TechNet Blogs ? The Microsoft Excel Support Team Blog (as mentioned):
我能找到的有关此问题的最佳信息和更新来源是在 TechNet 博客中?Microsoft Excel 支持团队博客(如前所述):
Form Controls stop working after December 2014 Updates (Updated March 10, 2015)
表单控件在 2014 年 12 月更新后停止工作(2015 年 3 月 10 日更新)
On March 2015 a hotfix was releasedin addition to the automated fix-it and manual instructions, and it's available on Windows Update as well.
2015 年 3 月,除了自动修复和手动说明之外,还发布了一个修补程序,它也可在 Windows 更新上使用。
The latest update and fix from Microsoft: 3025036 "Cannot insert object" error in an ActiveX custom Office solution after you install the MS14-082 security update
Microsoft 的最新更新和修复程序: 安装 MS14-082 安全更新后,ActiveX 自定义 Office 解决方案中出现 3025036“无法插入对象”错误
STATUS: Update March 10, 2015:
Hotfixes for this issue have been released in the March 2015 Updates for Office 2007, 2010 & 2013.
状态:2015 年 3 月 10 日更新:
此问题的修补程序已在 2015 年 3 月的 Office 2007、2010 和 2013 更新中发布。
General info about the problem:
有关问题的一般信息:
For some users, Form Controls (FM20.dll) are no longer working as expected after installing MS14-082 Microsoft Office Security Updates for December 2014. Issues are experienced at times such as when they open files with existing VBA projects using forms controls, try to insert a forms control in to a new worksheet or run third party software that may use these components.
https://technet.microsoft.com/en-us/library/security/ms14-082.aspx
You may receive errors such as: "Cannot insert object"; "Object library invalid or contains references to object definitions that could not be found"; "The program used to create this object is Forms. That program is either not installed on your computer or it is not responding. To edit this object, install Forms or ensure that any dialog boxes in Forms are closed." [...] Additionally, you may be unable to use or change properties of an ActiveX control on a worksheet or receive an error when trying to refer to an ActiveX control as a member of a worksheet via code.
对于某些用户,在安装 2014 年 12 月的 MS14-082 Microsoft Office 安全更新后,表单控件 (FM20.dll) 不再按预期工作。有时会遇到问题,例如当他们使用表单控件打开包含现有 VBA 项目的文件时,请尝试将表单控件插入新工作表或运行可能使用这些组件的第三方软件。
https://technet.microsoft.com/en-us/library/security/ms14-082.aspx
您可能会收到以下错误:“无法插入对象”;“对象库无效或包含对无法找到的对象定义的引用”;“用于创建此对象的程序是 Forms。该程序要么未安装在您的计算机上,要么没有响应。要编辑此对象,请安装 Forms 或确保关闭 Forms 中的所有对话框。” [...] 此外,您可能无法在工作表上使用或更改 ActiveX 控件的属性,或者在尝试通过代码将 ActiveX 控件引用为工作表成员时收到错误。
Manual and additional solutions:
手动和其他解决方案:
Scripting solution:
Because this problem may affect more than one machine, it is also possible to create a scripting solution to delete the EXD files and run the script as part of the logon process using a policy. The script you would need should contain the following lines and would need to be run for each USER as the .exd files are USER specific.
脚本解决方案:
由于此问题可能会影响多台计算机,因此还可以创建脚本解决方案来删除 EXD 文件并使用策略将脚本作为登录过程的一部分运行。您需要的脚本应该包含以下几行,并且需要为每个用户运行,因为 .exd 文件是特定于用户的。
del %temp%\vbe\*.exd
del %temp%\excel8.0\*.exd
del %appdata%\microsoft\forms\*.exd
del %appdata%\microsoft\local\*.exd
del %temp%\word8.0\*.exd
del %temp%\PPT11.0\*.exd
Additional step:
If the steps above do not resolve your issue, another step that can be tested (see warning below):
On a fully updated machine and after removing the .exd files, open the file in Excel with edit permissions.
Open Visual Basic for Applications > modify the project by adding a comment or edit of some kind to any code module > Debug > Compile VBAProject.
Save and reopen the file. Test for resolution.
If resolved, provide this updated project to additional users.
Warning: If this step resolves your issue, be aware that after deploying this updated project to the other users, these users will also need to have the updates applied on their systems and .exd files removed as well.
附加步骤:
如果上述步骤不能解决您的问题,则可以测试另一个步骤(请参阅下面的警告):
在完全更新的机器上,删除 .exd 文件后,使用编辑权限在 Excel 中打开该文件。
打开 Visual Basic for Applications > 通过向任何代码模块添加注释或某种编辑来修改项目 > 调试 > 编译 VBAProject。
保存并重新打开文件。测试分辨率。
如果解决,请将此更新的项目提供给其他用户。
警告:如果此步骤解决了您的问题,请注意,在将此更新后的项目部署给其他用户后,这些用户还需要在其系统上应用更新并删除 .exd 文件。
回答by Mike Pedersen
I did finally find this answer on the official Microsoft KB:
我终于在官方的 Microsoft KB 上找到了这个答案:
http://support.microsoft.com/kb/3025036/EN-US
http://support.microsoft.com/kb/3025036/EN-US
No new information here than what we have in previous answers, but at least it acknowledges that Microsoft is aware of the issue.
这里没有比我们之前的答案中的新信息,但至少它承认微软知道这个问题。
回答by chaltahai
I know many answers have already been posted for this, but neither one answer independently worked for my site. So here is what worked for me:
我知道已经为此发布了许多答案,但没有一个答案独立地适用于我的网站。所以这对我有用:
Step 1: Uninstall the following updates - KB2920789, KB2920790, KB2920792, KB2920793, KB2984942, KB2596927
步骤 1:卸载以下更新 - KB2920789、KB2920790、KB2920792、KB2920793、KB2984942、KB2596927
Step 2: Hide these updates so they do not get installed on subsequent reboots
步骤 2:隐藏这些更新,以免在后续重新启动时安装它们
Step 3: Delete folder Excel8.0 from C:\Users\<>\AppData\Local\Temp
步骤 3:从 C:\Users\<>\AppData\Local\Temp 中删除文件夹 Excel8.0
Step 4: Restart workstatiion (I would also make sure the above mentioned KBs did not inadvertently get applied)
第 4 步:重启工作站(我还要确保上面提到的知识库没有被无意中应用)

