ActiveX component can't create object: 'TDApiOle80.TDConnection'

Priyankar Mitra picture Priyankar Mitra · Aug 1, 2016 · Viewed 7.6k times · Source

I am trying to connect to QCServer using Excel Macro. I am using a 64-bit operating system with following being done:

  1. Register OTAClient.dll
  2. Installed HP ALM Connectivity tool
  3. Added OTA Library to reference

I am getting the following error:

ActiveX component can't create object: 'TDApiOle80.TDConnection'

QcConnection Error

But the same is running using VBScript:

C:\Windows\SysWOW64\Wscript.exe "C:\Users****\Desktop\qcConn.vbs"

VBScript

Answer

Arpit Jain picture Arpit Jain · Aug 5, 2016

I have found this solution on some other blog:

If you are on 64 bit machine, by default your script will run with the 64 bit version of wscript.exe. But QC is a 32 bit app, so you need to consume it from a 32 bit version of wscript.exe which is located at c:\Windows\SysWOW64\wscript.exe.

So what can be done to run it, call command line prompt in your macro and run your command:

C:\Windows\SysWOW64\Wscript.exe 

C:\Users****\Desktop\qcConn.vbs 

which will call that vbs. Eg:

Dim goWS: Set goWS = CreateObject("WScript.Shell")    
sCmd = "C:\Windows\SysWOW64\Wscript.exe "C:\Users****\Desktop\qcConn.vbs"""" 
Set oExec = goWS.Exec(sCmd)

Hope this helps !!