【发布时间】: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