Set Up Visual Basic

Return to Introduction  Previous page  Next page

Set References in Visual Basic

The following describes how to use the Enterprise Architect ActiveX interface with Visual Basic (VB). Use is ensured for Visual Basic version 6. This might vary slightly on versions other than version 6.

It is assumed that you have accessed VB through a Microsoft Application such as VB 6.0, MS Word or MS Access. If the code is not called from within Word, the Word VB reference must also be set.

On creating a new VB project, set a reference to an Enterprise Architect Type Library and a Word Type Library. Follow the steps below:

1.Select the Tools | References menu option. The following dialog displays:
2.Select the Enterprise Architect Object Model 2.10 checkbox from the list.
3.Do the same for VB or VB Word: select the checkbox for the Microsoft Word 10.0 Object Library.
4.Click on the OK button.

Note: If Enterprise Architect Object Model 2.10 does not appear in the list, go to the command line and manually re-enter Enterprise Architect using the following:

·To unregister Enterprise Architect: ea.exe /unregister
·To register Enterprise Architect: ea.exe /register

Visual Basic 5/6 users should also note that the version number of the Enterprise Architect interface is stored in the VBP project file in a form similar to the following:

Reference=*\G{64FB2BF4-9EFA-11D2-8307-C45586000000}#2.2#0#..\..\..\..\Program Files\Sparx Systems\EA\EA.TLB#Enterprise Architect Object Model 2.02

If you experience problems moving from one version of Enterprise Architect to another, open the VBP file in a text editor and remove this line. Then open the project in Visual Basic and use Project-References to create a new reference to the Enterprise Architect Object model.


Reference to objects in Enterprise Architect and Word should now be available in the Object Browser. This can be accessed from the main menu by selecting View | Object Browser, or by pressing [F2].

The drop-down list on the top-left of the window should now include Enterprise Architect and Word. If MS-Project is installed this must also be set up.