30

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?

Jeremy Thompson
  • 52,213
  • 20
  • 153
  • 256
Dave Lee
  • 363
  • 1
  • 4
  • 8

1 Answers1

53

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%\SysWOW64\wscript.exe myScript.vbs

or

%windir%\SysWOW64\cscript.exe myScript.vbs
Dirk Vollmar
  • 161,833
  • 52
  • 243
  • 303
  • 1
    After banging my head for a couple of hours, you saved the day! – Vitaliy May 08 '13 at 09:01
  • Do you know how to make this work for HTA applications, I'm seeing code like this: and making it like this obviously fails: **** – Jeremy Thompson Dec 04 '14 at 05:47
  • @JeremyThompson: You need to start the correct version of `mshta.exe`, i.e. the 32-bit version: `c:\Windows\SysWOW64\mshta.exe c:\page.hta`. If you want to enable starting the .hta by double-clicking in Explorer you probably could have your .hta restart with the correct version of mshta.exe. – Dirk Vollmar Dec 04 '14 at 10:15
  • Thanks Dirk, I tried `SysWOW64\mshta.exe` initially and it didn't force the VBS files to run under 32 bit that's why I was trying to do it in the HTA file. I'll report back when I get this working. – Jeremy Thompson Dec 05 '14 at 02:00
  • %windir%\SysWoW64\wscript.exe in Browse I used the file path in add arguments and I set the program start in path but I could not able to get that done.The task seems to be successfully completed but there is no output as expected – clarifier Nov 09 '15 at 12:25