【问题标题】:VB Script Documents.Open throwing 424 errorVB Script Documents.Open 抛出 424 错误
【发布时间】:2011-01-07 12:17:11
【问题描述】:

所以我有一个 vbs 脚本:

Function test2open( sSourceFile, sPDFFile )
  Dim wApp ' As Word.Application
  Dim wDoc ' As Word.Document

  logStream.writeline "inside test2open"
  on error resume next

  Set wApp = CreateObject("Word.Application")
  logStream.writeline Err.Number
  Err.Clear

  Set wDoc = wApp.Documents.Open("c:\Windows\Temp\test.DOC")
  logStream.writeline Err.Number
  logStream.writeline Err.Description
  logStream.writeline Err.Source

  wApp.Quit WdDoNotSaveChanges
  Set wApp = Nothing
End Function

我正在使用 cscript.exe 通过 apache 调用这个 vi php exec 调用。我不打算粘贴整个内容的主要脚本的重点是将word doc转换为pdf。但是我的完整脚本和上面的脚本都有同样的问题。

当我坐在 windows 框上时自己调用 vbs 脚本时,它会像我想的那样工作,但是当通过 php 通过 apache 远程调用时,它会在 Documents.Open 调用上出错,并带有 424 错误对象需要 Microsoft VBScript 运行时错误。

同样的代码在其他 2 个 Windows 框中正确运行,这让我认为这是某种权限问题(喜欢那些描述 MS 错误消息)。但我不知道是什么。有什么想法吗?

【问题讨论】:

  • 运行脚本的计算机上是否安装了 Word?我在尝试运行使用 Excel 对象的脚本时遇到问题,因为运行该脚本的通勤者上没有安装 Excel。
  • Yes word(和所有办公室)已安装。我发布的答案是解决方案。该问题与 MS 试图限制使用自动化办公产品有关。

标签: php vbscript ms-word apache2 documents


【解决方案1】:

我相信我已经找到了问题的答案。问题是微软正在限制办公产品自动化的使用。 Server 2008 64bit 和 office 2007 不能正常工作。对我有用的解决方案位于:

http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91?prof=required

万一线程消失:

This solution is ...

・Windows 2008 Server x64

  Please make this folder.

  C:\Windows\SysWOW64\config\systemprofile\Desktop

・Windows 2008 Server x86

  Please make this folder.

  C:\Windows\System32\config\systemprofile\Desktop

【讨论】:

  • 感谢您的解决方案,经过一天的研究,它帮助解决了我的问题。
猜你喜欢
  • 2019-05-23
  • 2014-01-31
  • 2016-11-08
  • 1970-01-01
  • 2013-10-05
  • 1970-01-01
  • 2016-10-03
  • 1970-01-01
  • 2018-07-22
相关资源
最近更新 更多