Book a Demo

Author Topic: Repository.Execute in VBA  (Read 6048 times)

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Repository.Execute in VBA
« on: December 05, 2014, 02:21:42 am »
Hi,

I've used Repository.Execute in C# without issue; I need to use it in a VBA code within an Excel sheet - i'm getting an 'object doesn't support this property or method' error. Is this a limitation of VBA - want recognize/allow the use of hidden methods ? Anyone come across this ?

Regards,

Jon.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Repository.Execute in VBA
« Reply #1 on: December 05, 2014, 06:35:42 am »
It shouldn't be an issue. I used it from Perl without any issue. So VB should recognize it as well. The auto-completion would not work. Maybe VB just stops working when encountering such methods. How about  Repository.CustomCommand?

q.

Knut Jetlund

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I am the lizard king. I can do anything
    • View Profile
Re: Repository.Execute in VBA
« Reply #2 on: December 05, 2014, 07:43:14 pm »
I'm using Repository.Execute in VB, like this:
rep.Execute("UPDATE T_DIAGRAM SET SHOWFOREIGN=FALSE WHERE DIAGRAM_ID=" & eD.DiagramID)

Regards,
Knut

Knut Jetlund
Norwegian Public Roads Administration

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.Execute in VBA
« Reply #3 on: December 05, 2014, 07:54:54 pm »
Ah, I think VBA is a bit weird in these types of things.
If it considers something a "sub" (function with no return value) then you have to call it without parenthesis, or either add call.
So either this
Code: [Select]
rep.Execute "UPDATE T_DIAGRAM SET SHOWFOREIGN=FALSE WHERE DIAGRAM_ID=" & eD.DiagramIDor this
Code: [Select]
Call rep.Execute("UPDATE T_DIAGRAM SET SHOWFOREIGN=FALSE WHERE DIAGRAM_ID=" & eD.DiagramID)
Geert

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: Repository.Execute in VBA
« Reply #4 on: December 05, 2014, 08:25:21 pm »
OK - humble pie time - it wasn't repository.execute in vba - it was a typo in a method call being used to construct the sql on the fly....Thanks both for your help/input...