Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
533 views
in Technique[技术] by (71.8m points)

vbscript - Cannot use CreateObject from VB scripts on Windows 7 x64

When I try to create a COM object in VB script on a Windows 7 (64 bit) machine, I always get the following error:

"ActiveX component can't create object 'xxx.xxx'. Code: 800A01AD

I have applications that use the COM object without any problem. I have tried running the command line in admin mode, no difference.

Is there any way to enable this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The VBScript interpreter (cscript.exe/wscript.exe) comes in two flavors on a 64-bit version of Windows: a 32-bit version and a 64-bit version.

The 32-bit version can create and use 32-bit COM components only, and the 64-bit version can create and use only 64-bit COM components.

By default, .vbs files are associated with the 64-bit version. You COM component is most likely a 32-bit one, hence the error.

You can find the 32-bit version in the %windir%SysWOW64 folder. Launching this version should give you access to all 32-bit COM components:

%windir%SysWOW64wscript.exe myScript.vbs

or

%windir%SysWOW64cscript.exe myScript.vbs

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...