Author Topic: CreateObject doesn't work in version 4.00  (Read 5055 times)

annavp

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
CreateObject doesn't work in version 4.00
« on: June 09, 2004, 02:23:45 am »
Hi,

I am working with a registered version  4.00. I read in the release notes that the CreateObject bugs should be fixed as from version 3.60.

I'm creating a .VBS (visual basic script) file and I want to access an existing EA repository. I use the following script:
____________________________________________

Set  MyRep = CreateObject("EA.Repository")
myrep.OpenFile ctEAPName
......
____________________________________________

I also tried
____________________________________________

Set MyRep = GetObject("", "EA.Repository")
____________________________________________

but I got the same problem.

Any thoughts?

Thanx, anna

Jon

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: CreateObject doesn't work in version 4.00
« Reply #1 on: June 09, 2004, 02:43:59 am »
I suspect your problem lies elsewhere, or you may have a corrupted installation of EA (try reinstalling as a last resort).  The following code snippet works fine on my pc:

Code: [Select]

Set myrep = CreateObject("EA.Repository")
result = myrep.OpenFile("Z:\Model.EAP")
MsgBox result
myrep.Exit


At risk of stating the obvious, your model file does exist doesn't it?

Cheers
Jon

annavp

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: CreateObject doesn't work in version 4.00
« Reply #2 on: June 09, 2004, 05:30:14 am »
Yep

model exists!!!

I tried this one and that works but I cna't use this in a script.

   Dim myrep As New EA.Repository      
   myrep.OpenFile ctEAPName

anna

annavp

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: CreateObject doesn't work in version 4.00
« Reply #3 on: June 09, 2004, 08:18:23 am »
I tried this piece of code and I get
"could not open file" message

code:

[size=10]Set  MyRep = CreateObject("EA.Repository")

If Not myrep.OpenFile(ctEAPName) = False Then
 MsgBox "Repository opened!"
Else
 MsgBox "Could not open file!"
End If[/size]

anna

Bhupinder

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: CreateObject doesn't work in version 4.00
« Reply #4 on: June 16, 2004, 10:08:21 am »
have you reimported the type library after updating to the registered version?

I had a similar problem in my delphi apps.

Bas