Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: OpenIT Solutions on December 05, 2014, 02:21:42 am

Title: Repository.Execute in VBA
Post by: OpenIT Solutions 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.
Title: Re: Repository.Execute in VBA
Post by: qwerty 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.
Title: Re: Repository.Execute in VBA
Post by: Knut Jetlund 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

Title: Re: Repository.Execute in VBA
Post by: Geert Bellekens 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
Title: Re: Repository.Execute in VBA
Post by: OpenIT Solutions 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...