VB Script Documents.Open 抛出 424 错误 [英] VB Script Documents.Open throwing 424 error

查看:46
本文介绍了VB Script Documents.Open 抛出 424 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个 vbs 脚本:

So I have a vbs script:

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.但是我的完整脚本和上面的脚本都有相同的问题.

I'm calling this vi php exec call through apache with cscript.exe. The point of the main script which I'm not going to paste the whole thing is to convert a word doc to a pdf. But both my full script and the one above have the same issue.

当我坐在 Windows 框上时自己调用 vbs 脚本时,它的工作原理和我想的一样,但是当通过 apache 通过 php 远程调用时,它在 Documents.Open 调用上出错,424 错误对象需要 Microsoft VBScript 运行时错误.

When I call the vbs script by itself while sitting on the windows box it works as I would think, but when called remotely through apache through php it errors on the Documents.Open call with 424 Error Object required Microsoft VBScript runtime error.

同样的代码在其他 2 个 Windows 机器上正确运行,这让我认为这是某种权限问题(喜欢那些描述 MS 错误消息).但我无法弄清楚是什么.有什么想法吗?

This same exact code is running correctly on 2 other windows boxes which makes me think this is some kind of permission issue (love those description MS error messages). But I cannot figure out what. Any thoughts?

推荐答案

我相信我已经找到了问题的答案.问题是微软限制了办公产品自动化的使用.Server 2008 64bit 和 office 2007 运行不佳.在以下位置找到了对我有用的解决方案:

I believe I've found the answer to my question. The problem is that MS is restricting the use of automation of office products. Server 2008 64bit and office 2007 just don't work well. The solution that worked for me was found at:

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

这篇关于VB Script Documents.Open 抛出 424 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆