Hi Guillaume,
I use the code below to create relationships in Excel. There are a number of further properties that can be changed. You will need to set up your worksheet in the following format:
SourcePackage, SourceType,SourceName,SourceID,TargetPackage,TargetType,TargetName,TargetID,RelationshipType,RelationshipName
Note that the 'RealtionshipType' filed is a drop down with the following options:
Association
Aggregation
Composition
Dependency
Generalization
Realization
Trace
Extension
Sub relationshipcreate(outputws As Worksheet)
Dim x As Integer
x = 3
Do Until IsEmpty(outputws.Cells(x, 4))
If IsEmpty(outputws.Cells(x, 4)) Or IsEmpty(outputws.Cells(x,

) Or IsEmpty(outputws.Cells(x, 9)) Then
MsgBox "The relationships have not been populated correctly in row " & x & vbCrLf & vbCrLf & "Please check the " & outputws & " tab" & _
vbCrLf & vbCrLf & x - 3 & " relationships have been created in EA", vbOKOnly
Exit Sub
Else
Call addConnector(outputws.Cells(x, 4), outputws.Cells(x,

, outputws.Cells(x, 9), outputws.Cells(x, 10))
x = x + 1
End If
Loop
MsgBox x - 3 & " relationships have been created in EA", vbOKOnly
outputws.Select
outputws.Cells.EntireColumn.AutoFit
outputws.Cells(3, 1).Select
End Sub
Function addConnector(SourceElementID, TargetElementID, ConnectorType, connectorname)
Dim SourceElement As EA.element
Dim newconnector As EA.connector
Dim repository As EA.repository
Set eaapp = GetObject(, "EA.App")
Set repository = eaapp.repository
Set SourceElement = repository.GetElementByID(SourceElementID)
Set newconnector = SourceElement.connectors.AddNew(" ", ConnectorType)
newconnector.SupplierID = TargetElementID
newconnector.Name = connectorname
newconnector.Update
Set addConnector = newconnector
End Function
Hope that helps,
Rupert