Thanks for the answer, in the end I believe I have solved that it putting in listbox the index of the row and passing this one to the commando to insert, not if it could cause some problem to me
Private Sub button1_Click()
Dim InvApp As Inventor.Application
Set InvApp = GetObject(, "Inventor.Application")
' Open the factory document invisible.
Dim oFactoryDoc As PartDocument
Set oFactoryDoc = InvApp.Documents.Open("C:\Temp\Abarcon generales.ipt", False)
' Set a reference to the component definition.
Dim oCompDef As PartComponentDefinition
Set oCompDef = oFactoryDoc.ComponentDefinition
' Set a reference to the factory.
Dim oiPartFactory As iPartFactory
Set oiPartFactory = oCompDef.iPartFactory
' Get the number of rows in the factory.
Dim iNumRows As Integer
iNumRows = oiPartFactory.TableRows.Count
Dim oStep As Integer
oStep = 0#
Dim irow As Integer
For irow = 1 To iNumRows
oStep = oStep + 10
Dim nombre As String
nombre = CStr(oiPartFactory.TableRows(irow).MemberName)
Dim elementos As Variant
Dim indice As String
Dim fila As String
elementos = Array(irow, oStep)
indice = elementos(0)
fila = elementos(1)
listbox1.AddItem (irow & ";" & nombre)
Next
End Sub
Private Sub Button2Click_Click()
Dim InvApp As Inventor.Application
Set InvApp = GetObject(, "Inventor.Application")
' Get the active assembly document
Dim oDoc As AssemblyDocument
Set oDoc = InvApp.ActiveDocument
Dim oOccs As ComponentOccurrences
Set oOccs = oDoc.ComponentDefinition.Occurrences
Dim oFactoryDoc As PartDocument
Set oFactoryDoc = InvApp.Documents.Open("C:\Temp\Abarcon generales.ipt", False)
' Set a reference to the component definition.
Dim oCompDef As PartComponentDefinition
Set oCompDef = oFactoryDoc.ComponentDefinition
' Set a reference to the factory.
Dim oiPartFactory As iPartFactory
Set oiPartFactory = oCompDef.iPartFactory
Dim oStep As Double
oStep = 10#
Dim SeleccionIpart As Integer
SeleccionIpart = listbox1.Column(0)
'Dim nombre As iPartMember
'Set nombre = oCompDef.iPartMember.Row
Dim oPos As Matrix
Set oPos = InvApp.TransientGeometry.CreateMatrix
'Add a translation along X axis
oPos.SetTranslation InvApp.TransientGeometry.CreateVector(oStep, oStep, 0)
Dim oOcc As ComponentOccurrence
Set oOcc = oOccs.AddiPartMember("C:\Temp\Abarcon generales.ipt", oPos, SeleccionIpart)
MsgBox ("Ipt inserted")
End Sub
Thanks