找不到 Microsoft Forms 2.0 对象库或 FM20.DLL

Can't find Microsoft Forms 2.0 Object Library or FM20.DLL

在我的 Excel 2016 项目 (Windows 7) 中,我想使用剪贴板:

Dim DataObj As New MSForms.DataObject
DataObj.GetFromClipboard

但是我在第一行代码处遇到了这个编译器错误:

User-defined type not defined

所以我想添加对 Microsoft Forms 2.0 对象库的引用,但我的整个计算机上没有 FM20.DLL 文件(我已经通过 explore 和 find 使用 cygwin 进行了搜索)。

我希望像下面的屏幕截图那样看到它,但我找不到它。

我怎样才能让它出现?

来自 this old knowledge base article 我的猜测是这个 DLL 可能只包含在旧版本的 Office 中?这部分看起来很有希望:

As an alternative to having your end users install Microsoft Office, you can have them freely download and install the Microsoft ActiveX Control Pad, which also installs the Fm20.dll. For more information, see the following Microsoft Developer Network (MSDN) Web site: http://msdn.microsoft.com/en-us/library/ms968493.aspx

但是,由于链接工具来自 1997 年,您需要 运行 在 "compatibility mode" 中设置它,方法是右键单击可执行文件并选择 "Properties",然后单击"Compatibility" 选项卡并在 "Run this program in compatibility mode for:" 下拉列表中选择 "Windows 95"。然后 运行 它作为管理员(这对我有用 Windows 8.1)。

那个图书馆真的应该在那里。我刚刚检查了我的 Excel 2016 安装(32 位),它默认存在(只是未选中)。如果你的 Office 不存在,我建议你修理它。

在 64 位机器上,FM20.dll 位于 C:\Windows\sysWOW64 目录中。它是 32 位的。

我在 C:\Program Files (x86)\Microsoft Office\root\VFS\SystemX86 中找到 FM20.DLL;那是 MS Office 2016 和 Windows 10。

或许您可以尝试使用 CLSID 进行后期绑定

将 MyDataObj 变暗为对象 设置 MyDataObj = CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")

或类似的东西。

还要补充一点,我发现当 MS .accdb 文件 copied/pasted 用于备份时,VBA 对 FM20.dll 的引用可能会丢失,因此需要重新建立。