Simple VBA Excel to EA importer v4.2
Version 4.2 of the Excel to EA Importer now introduces a new GUI to follow the progress of the import, and a massive increase in performance.
The Excel to EA importer is a rather simple tool to import stuff into EA. It has been available on the Sparx Community Site since 2009 and it has always been one of the most popular resources.
Version 2 was a small improvement allowing for different types of Elements.
Version 3 added the feature to import the glossary into EA.
Version 4 added the Tagged values Import and Export
Version 4.2 features a whole new user interface that allows you to select the import package, follow the progress of the import, and cancel an import in progress.
So instead of immediately starting the import once you click on the Import button on the ribben, you now get this little window.
Clicking the […] button allows you to select a different import package.
Pressing Cancel while importing will immediately stop the import in progress.
Next to the new user interface the performance has increased drastically. A large import that would have taken minutes using the previous version of the importer, now takes mere seconds.
The actual import functionality has not been changed.
Elements and Attributes
Columns A till F are used in the sheet ElementsAndAttributes . Fill in the the columns with your own data.
Fill in the type of the Element you wish to import. This column should contain either Attribute or one of the EA Element types as defined in the documentation of EA.Element.Type. An attribute will be added to the last specified Element.
The name of the element or attribute.
The stereotype of the element or attribute. Use null to specify an empty stereotype.
The description of the element or attribute.
- Attribute Type
The type of the attribute. This column should not be used for Elements. Use null to specify an empty type.
- Attribute Length
This value will be added as a tagged value with the name length on the attribute. Again this is only for attributes.
In the 2nd sheet Glossary you can fill in columns A until C with:
The term name is mandatory.
The type of the term is mandatory as well
The meaning of the term is optional.
The Tagged Values sheet can only be used to edit existing tagged values, not for importing new tagged values into EA. It contains the following columns
The unique identifier of the tagged value. Used to find the tagged value in the model. – Do not change.
Used to indicate if the tagged value is on an element, attribute, operation or connector. – Do not change
The name of the tagged value. This field can be used to rename tagged values
The value of the tagged value. This field can be edited.
The notes of the tagged value. This field can be edited.
The name of the element that owns the tagged value. Used as a context indicator. Changing this field will have no effect.
Once all you data has been filled in you are ready to import the data into EA.
- Open the sheet you wish to import
- If you are on the ElementsAndAttributes sheet press the button Import, or run the macro (Alt-F8) importFromExcel
- If you are on the Glossary sheet press the button Import Glossary, or run the macro (Alt-F8) importGlossaryFromExcel
- On the Tagged Values sheet you can press the button Export Tagged Values, or run the macro (Alt-F8) exportTaggedValuesFromEA in order to get all tagged values into the sheet.
- After modifying the content of the tagged values press the button Import Tagged Values, or run the macro (Alt-F8) importTaggedValuesFromExcel and press start to start import.
The code of this little tool is embedded as VBA in the document, and as such can be edited by anyone with basic programming skills.
To open the code editor press Alt-F11.
There are three major parts for the code
The module that contains the importFromExcel macro. This is where you want to make changes.
A facade for EA’s API containing all kinds of useful functions. You probably don’t need to change anything here.
A facade for Excel with the code to get the values of the sheet. Again probably no need to change anything here.
Both the Excel file as the VBA code embedded in it is free for use. Just be kind and leave the reference to my name in the code if you use it.
thank you for your tool “Simple VBA Excel to EA importer v4.2”. This is very usefull !
Is it possible to “move” the VBA code from the excel sheet into EA ?
Now VBScript and VBA are much alike, so you translate the VBA code rather easily to VBScript.
The main thing is to remove the “As Sometype” statements, and any possibly named arguments.
Another issue is the use of library objects such as Collection, or the Excel API objects.
For something like collection you can use ArrayList in stead. The excel API objects you’ll have to create explicitly using CreateObject
Hi, Geert. Thanks so much for creating tool. I am struggling to make it work, though. Are there simple instructions somewhere that explain what needs to exist in EA before I run it?
Hi Geert. This tools looks really promising. But.. When I try to run the macro in my Excel 365. It get stuck on the first line in model “Dim EaRepos as Ea.repository”. With the message Compile Error: Can’t find project or library. Presssing OK I come to Check list of Available reference. Do I need to click a special librarary for this macro to work with EA? If so which one. It looks like can either select from a large available list or browse for a specific library.
Can you give me any guidance? on how to get it to work?
Yes, you need to add the EA object librabry in the references.
It’s called Enterprise Architect Object Model 2.10 and can be added by selecting the EA.tlb from the sparx EA program files folder
Thank you for the Simple VBA Excel Import to EA AddOn. However, I use it for importing a class and attributes with datatype. I have two questions:
1. The attributes are alphabetically reordered during import. How can I prevent that reordering?
2. The datatype of the attributes is not imported. What can be the cause?
Thank you for your help.
There is an option in EA to force alphabetic ordering of attributes. You probably have this option on.
Thanks for your answer. But I tried that already, but doesn’t have effect. It keeps the alphabetical order of the attributes. Maybe you know a solution for this? The datatype question is solved by the way.