rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.91k stars 299 forks source link

Other than office VBA? #3221

Closed VeryTidyBoy closed 7 years ago

VeryTidyBoy commented 7 years ago

Hi All. Thanks so much for all your work. I would like the facility to identify and add-in to the VBA editor in other than Office apps. I know their are other users| environments, but the one I am interested in at the moment is Arena by Rockwell. It may (i think it does) use a different VBA installation version and location ie not in the shared office library space. So can anyone a) Write an editable script; or b) Outline where the changes need to be in the source code; or c) Modify the installer so that I can browse for the application (eg. Arena)? If it currently wouldn't be possible then just a note, to let other users know, would be helpful. Best Regards, Richard Clark

retailcoder commented 7 years ago

Hi, not sure what Arena is, but Rubberduck is absolutely not constrained to Office, and works in any VBE host. Unit tests need a special host-specific bit of code/logic so that Rubberduck can know how to invoke the test methods in that host application, but other than that... If Rubberduck is registered for the bitness of your host application, it "just works"... so long as the application is hosting a VBE environment - exactly what do you mean by a different VBA installation version and location?

retailcoder commented 7 years ago

http://www.globalspec.com/reference/39338/203279/appendix-b-vba-in-arena

Sounds like VBA to me. Note that the installer will register the add-in for the bitness of the Microsoft Office install it finds on your machine. If you have other VBA host applications of a different bitness, you'll need to register the add-in manually. See the installing wiki page for the registry keys to create, and the regasm.exe command to run as administrator to register for both 32 and 64 bit hosts.

ThunderFrame commented 7 years ago

Rubberduck should be loading under any VBA 6.x/7.x. It is only the Unit Testing feature that requires host-specific code. Unit testing is currently enabled in Excel, Word, PowerPoint, Access, Outlook, Project, Visio, CorelDRAW, SolidWorks and AutoCAD (although it seems AutoCAD might be broken at the moment).

The only requirement of a host, in order to allow Rubberduck to execute tests, is the presence of a method that can run a named macro. In most Office applications, that is the Application.Run method (and it accepts a string with the name of the macro), but Rockwell might use a different method, or not have one at all. Some hosts, such as WordPerfect do support VBA (and Rubberduck), but they don't expose anything like a Run method, so for the time being, Rubberduck doesn't have any way of executing the tests.

I don't have access to any Rockwell products, but I suspect that this StackOverflow answer is at least one way of executing a model. You might find that a Run method (or something similar) exists under the Application object, or it may be under the model object, or it might even be on the SIMAN object.

If you can find a suitable method, then we can work with you to add Arena as a unit-testing enabled host, as per https://github.com/rubberduck-vba/Rubberduck/wiki/Adding-a-new-Host-Application-to-Rubberduck

VeryTidyBoy commented 7 years ago

Thanks Guys. I will try the installing wiki page notes and then follow through and let you know when I know more. Brilliant responsiveness by the way. Cheers Richard.

VeryTidyBoy commented 7 years ago

OK. [Retailcoder] Using the installing notes for 64 bit I get the described RegAsm message. Tick VG. When I look in the VBE references I can now see the checkbox for RubberDuck. So far so good. But that is it, no Menu entry and no Rubberduck in the add-in manager.

Now moving on to [ThunderFrame]'s advice. BR Richard

VeryTidyBoy commented 7 years ago

PS. The install worked fine out of the box for my Office apps, so I realise I am in a much smaller population that would like to use it for other environments/Host apps such as Arena. BR Richard

retailcoder commented 7 years ago

@VeryTidyBoy if RD isn't listed in the add-ins manager then you're missing the registry key for Rubberduck.Extension under HKCU:Software/Microsoft/VBA/VBE/6.0/AddIns[64].

VeryTidyBoy commented 7 years ago

Good stuff! Thanks retailcoder, you got me there. I don't like to fiddle with the registry unless I am sure I have to. But, as you correctly deduced, that was the problem. And so far everything else is still working. BR Richard. PS: Again, brilliant responsiveness, be proud!

ThunderFrame commented 7 years ago

@VeryTidyBoy Microsoft doesn't allow 32-bit and 64-bit installs of Office apps on the same PC, but there's nothing to stop you having 32-bit Office and 64-bit Rockwell Arena, or 64-but Office and 32-bit Arena....

But for Rubberduck to work in both 32-bit and 64-bit hosts, you need to ensure that the Rubberduck registry entries are present in the 32-bit registry keys and the 64-bit registry keys.

VeryTidyBoy commented 7 years ago

Yes Thunderframe, I was worried about that but, as retailcoder tactfully pointed out, I just needed to follow all of the installation instructions . As an aside, We do seem to be making life complicated for ourselves don't we, as software evolves. The danger used to be spaghetti code, then it was lasagne object structures. Now we seem to be heading for microservices, which raises the prospect of signalling hell (which was a mainframe issue) and container problems like which russian doll is that in, and at which level. I wonder if we would do better if we started from scratch right now but with the 40 years of Software Engineering that we have behind us.

Anyway, thanks very much. BR Richard.