VBA CreateObject() Can’t create ActiveX component on 64Bit Windows

If you are running on a 64bit windows 7 system and have a VBA script that creates a COM/ActiveX/OLE component which fails with an error message like:


‘ActiveX component can’t create object’


Even though you know the component is registered and that you are using the correct progId etc, then it may be failing because the COM component in question is 32 bit and by default Windows7 runs the 64bit scripting engine.


If this is the case then you can get around the problem by explicitly using the 32 bit scripting environment which is most likely located here:




So to run example.vbs in the 32bit environment use the following:


C:\Windows\SysWOW64\cscript.exe example.vbs


Hopefully you 32bit component will now load… mine did ;)


Class not Registered #64bit Active#Perl win32::OLE

If you are getting an error message along the lines of ‘Class Not Registered’ when using Win32::OLE to create a COM object when using 64Bit ActiveState Perl and you are sure that the class is registered then it may be because the COM dll is 32bit and the 64bit perl process can’t load it….


I have found that the easiest (laziest?) way to work around this is to un-install the 64bit perl and install the 32bit version instead – not a perfect workaround but it works for me!