使用 Excel 2010 的类字符串无效

发布于 2024-09-08 13:19:07 字数 315 浏览 2 评论 0原文

我有一个第三方旧版软件,它使用自动化来控制 MS Excel(使用 MFC/C++)。代码很简单:

_ApplicationPtr xl;
HRESULT hr = xl.CreateInstance("Excel.Application");

从 Excel 2000、2002 (XP)、2003 和 2007 开始,这一切都完美运行;但是,安装 Office 2010 后,CreateInstance 调用失败并显示“无效类字符串”(CO_E_CLASSSTRING)。我需要做什么特别的事情才能让它发挥作用吗?

提前致谢!

I have a third-party legacy software that uses Automation to control MS Excel (using MFC/C++). The code is straightforward:

_ApplicationPtr xl;
HRESULT hr = xl.CreateInstance("Excel.Application");

This worked perfectly since Excel 2000, 2002 (XP), 2003 and 2007; however, after installing Office 2010, the CreateInstance call fails with "Invalid Class String" (CO_E_CLASSSTRING). Is there anything special I need to do to get this to work?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野味少女 2024-09-15 13:19:07

类字符串是 "Excel.Application" 部分,大概是 Microsoft 在 Office 2010 中进行了更改。

通常,它类似于“Excel9.Application”代表“真实”值,“Excel”代表“实际”值。 .Application”指向最新版本的特定条目。可能是 MS 停止添加指针条目,或者您的注册表在升级过程中被搞乱了。

The class string is the "Excel.Application" part, which, presumably, Microsoft has changed in Office 2010.

Normally, it's something like "Excel9.Application" for the "real" value, and "Excel.Application" pointing to the latest version specific entry. It's possible the MS stopped adding the pointer entry, or your registry got messed up in the upgrade.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文