Automation Interface Examples: Setting Up EA in Visual Basic


Setting References in Visual Basic
This page is intended to explain the procedure used to set up an Enterprise Architect ActiveX interface with Visual Basic. Usage is ensured for version 6. This may vary slightly on different versions of Visual Basic. It is assumed that VB has been accessed 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 project, set a reference to an Enterprise Architect Type Library and a Word Type Library as follows:

  1. Select References on the Tools menu.

  2. Select the check box for Enterprise Architect Object Model 2.10 from the list.

  3. Do the same for VB or VB Word - select the check box for the Microsoft Word 10.0 Object Library.

  4. Press OK.

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

  • To unregister EA: ea.exe /unregister
  • To register EA: ea.exe /register

 

Visual Basic 5/6 users should note that the version number of the EA 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 EA 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 EA Object model.


Reference to objects in EA and Word should now be available in the Object Browser. This can be accessed from the Main Menu by selecting View then Object Browser, or by pressing F2. See right.

The drop down list on the top-left of the window should now include EA and Word (if MS-Project is installed this will also need to be set up).

 

Return to Automation Interface Introduction page