user1637813
user1637813

Reputation: 11

Activex component can't create object:'xyz'

I have written the following piece of VB script which opens an existing aplication xyz from the path I specfied. The application (a custom windows application) opens succesfully. (I would like to use the automation interface of this application in my vb script.) for that I call CreateObject.

But, then I also get the error Activex component can't create object: 'xyz' for the line Set xyzObj = CreateObject("xyz"). The error is from this line, since if I remove this line there is no error.

Dim objShell 

Set objShell = CreateObject( "WScript.Shell" ) 
objShell.Exec("C:\abc\def\xyz.exe") 

Set xyzObj = CreateObject("xyz")

Set objShell = Nothing 

Upvotes: 1

Views: 1292

Answers (1)

peter
peter

Reputation: 42207

You can't use CreateObject like that with a external program, started in your script or otherwise. CreateObject loads a COM-object that is registered on your pc. Google on vbscript and COM objects and you'll find plenty of info like at http://technet.microsoft.com/en-us/library/ee156598.aspx. If you want to interact with a started program you could use the sendkeys method or better use the autoit com object , see http://www.autoitscript.com/autoit3/docs/intro/ComRef.htm

Upvotes: 1

Related Questions