在 Delphi 中启动 Word x64
我目前正在开发一个非常旧的项目,该项目基于 Delphi 5。当我尝试在 x64 系统上打开新的 Word 文档时,我收到此错误:
根据 MSDN,问题的根源可能是我的Office版本(x64)。在应用程序中,我们使用 TWordApplication 对象来管理 Word 调用。这个问题有什么解决办法吗?在 Office x86 上一切正常。
这是代码的一部分:
Word := TWordApplication.Create(nil);
Word.ConnectKind := ckNewInstance;
Word.AutoQuit := True;
Word.Connect;
Word.Options.CheckSpellingAsYouType := False;
Word.Options.CheckGrammarAsYouType := False;
Word.Options.SuggestSpellingCorrections := False;
Word.Options.CheckGrammarWithSpelling := False;
Word.Options.ShowReadabilityStatistics := False;
Word.Options.IgnoreInternetAndFileAddresses := False;
Word.Options.IgnoreUppercase := True;
Word.Options.IgnoreMixedDigits := True;
Word.Options.ReplaceSelection := True;
I am currently working on very old project, which is based on Delphi 5. When I am trying to open new Word document on x64 system, I recive this error:
According to MSDN, the source of problem might be the version of my Office (x64). In application we use TWordApplication object to manage Word invoking. Is there any solution for that problem? On Office x86 everything works fine.
This is part of the code:
Word := TWordApplication.Create(nil);
Word.ConnectKind := ckNewInstance;
Word.AutoQuit := True;
Word.Connect;
Word.Options.CheckSpellingAsYouType := False;
Word.Options.CheckGrammarAsYouType := False;
Word.Options.SuggestSpellingCorrections := False;
Word.Options.CheckGrammarWithSpelling := False;
Word.Options.ShowReadabilityStatistics := False;
Word.Options.IgnoreInternetAndFileAddresses := False;
Word.Options.IgnoreUppercase := True;
Word.Options.IgnoreMixedDigits := True;
Word.Options.ReplaceSelection := True;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题似乎出在附加到文档的 VBA 代码中,而不是 Delphi 代码中。具体来说,涉及一个名为 API 的隐藏模块。也许这是在模板或加载项或自动启动中。
隐藏模块受到保护,这表明您可能无法修改该模块。您可以尝试联系受保护模块的作者,或者删除引入该模块的任何内容。
恢复到 32 位 Office 是一个更简单的解决方案。这将要求您首先卸载 64 位 Office,因为这两个版本不共存。
The problem appears to be in the VBA code attached to your document rather than the Delphi code. Specifically a hidden module named API is implicated. Perhaps this is in a template or an add-in or an auto start.
Hidden modules are protected which suggests that you may not be able to modify the module. You could try contacting the author of the protected module or perhaps removing whatever it is that introduced this module.
Reverting to 32 bit Office is an easier solution. This will require you to uninstall 64 bit Office first since the two editions do not co-exist.