无法创建 Word.Application

发布于 2024-09-14 12:11:45 字数 342 浏览 3 评论 0原文

这很奇怪。我正在尝试从终端服务器运行一个非常简单的 vbs 代码,除其他外,我还有这一行:

Set objWord = CreateObject("Word.Application")

奇怪的是,这昨天有效。但现在,所发生的只是 wscript.exe 似乎挂起。我什至尝试在创建 Word 对象之前和之后放置一个消息框。并且之后的消息框永远不会显示。然而,在我的本地计算机上,这工作正常。是的,终端服务器确实安装了 Word。

可能是什么原因造成的?

编辑:从模板中执行此例程是否更好?我的意思是,这将消除创建 Word 对象的需要,因为一旦打开模板,它就已经创建了。

this is pretty strange. I'm trying to run a pretty simple vbs code from a terminal server and I have amongst others, this line:

Set objWord = CreateObject("Word.Application")

Strangely enough, this worked yesterday. But now, all that happens is that wscript.exe just seems to hang. I even tried to put a messagebox before the creation of the Word object and after. And the message box after is never shown. On my local computer however, this works fine. And yes, the terminalserver does have Word installed.

What could be causing this?

Edit: Is it better to do this routine from the templates instead? I mean, that would eliminate the need to create the Word object since it's already created once the templates is opened.

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

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

发布评论

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

评论(1

冧九 2024-09-21 12:11:45

我会从你的脚本中杀死 winword.exe,然后运行 ​​objword 命令。这可能有帮助。

i'd kill winword.exe from your script, and then run the objword command. That could help.

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