64位操作系统下调用32位com的问题

时间:2023-03-09 03:03:53
64位操作系统下调用32位com的问题

Hello Guys!

I am trying to create a simple VBS script to automatically open some .tif images from a specified path on a server with Microsoft Office Document Imaging. There is a COM available, but it did not work when I used scripts found on the web:

Set objShell = WScript.CreateObject("WScript.Shell") ObjShell.exec("C:\Program Files (x86)\Common Files\microsoft shared\MODI\12.0\MSPVIEW.EXE") Set ObjShell=Nothing CreateObject("Scripting.FileSystemObject") Set MiDoc = CreateObject("MODI.Document")

miDOC.Create = scanurl  //这个程序员这个地方用的错误

Set miDoc = Nothing

When I tried to launch it, an error occured:

---------------------------
Windows Script Host
---------------------------
Script: Y:\BlankInvoices.vbs
Line: 42
Char: 1
Error: ActiveX component can't create object: MODI.Document'
Code: 800A01AD
Source: Microsoft VBScript runtime error

I found out, that there is a need to set a reference to 'Microsoft Office Document Imaging 11.0 Type Library' to get this working, but I have no idea how to do it. Unfortunately, I will probably not be able to install some external stuff to get this working. Please advise guys!

Not a sciprting problem.  YOu wilkl have to trouble shoot this on your own.

If these two lines fail you have some serious issue with MODI or with OCM.

Set mdi = CreateObject("MODI.Document")
mdi.Create("Y:\test.tif")

Put only those two lines in a ANI file with a VBS exrension.

On a 64 bti system run the file like this:

c:\windows\syswow64\cscript yourfile.vbs     //重点

on 32 bit:

cscript yourfile.vbs

If that does not work then it is likely that you have problems that cannot be solved in this forum.

也就是说在64位环境下开发使用32位库时务必注意,曾经在64位下使用ADO,到了32位下就挂了,今天又遇到这个问题,备注下。