Set References In Visual Basic

This topic describes how to use the Enterprise Architect ActiveX interface with Visual Basic (VB). Use is ensured for Visual Basic version 6, but might vary slightly with 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.

How to

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

Step

Action

See also

1

Select the Tools | References menu option.

 

 

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.

 

 

Notes

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, which 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, also set this up