无法创建 Word.Application
这很奇怪。我正在尝试从终端服务器运行一个非常简单的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会从你的脚本中杀死 winword.exe,然后运行 objword 命令。这可能有帮助。
i'd kill winword.exe from your script, and then run the objword command. That could help.