Thank you. Worked perfect!
What I wanted to do was to create a shortcut to cycle in the iPart table.
Here is a screencast of it working: https://autode.sk/30kkegZ
This is the code I have. Any tip to improve the code?
'iPart Select Previous
Dim oDoc = ThisDoc.Document
If oDoc.DocumentType = 12290 'kPartDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oFactory As iPartFactory = oDef.iPartFactory
Dim oRow As iPartTableRow
If oFactory.DefaultRow.Index = 1 Then Return
If oDef.IsiPartFactory Then
oRow = oFactory.TableRows.Item(oFactory.DefaultRow.Index - 1)
oFactory.DefaultRow = oRow
End If
End If
If oDoc.DocumentType = 12291 'kAssemblyDocument
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oFactory As iAssemblyFactory = oDef.iAssemblyFactory
Dim oRow As iAssemblyTableRow
If oFactory.DefaultRow.Index = 1 Then Return
If oDef.IsiAssemblyFactory Then
oRow = oFactory.TableRows.Item(oFactory.DefaultRow.Index - 1)
oFactory.DefaultRow = oRow
End If
End If
'iPart Select Next
Dim oDoc = ThisDoc.Document
If oDoc.DocumentType = 12290 'kPartDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oFactory As iPartFactory = oDef.iPartFactory
Dim oRow As iPartTableRow
If oFactory.DefaultRow.Index = oFactory.TableRows.Count Then Return
If oDef.IsiPartFactory Then
oRow = oFactory.TableRows.Item(oFactory.DefaultRow.Index + 1)
oFactory.DefaultRow = oRow
End If
End If
If oDoc.DocumentType = 12291 'kAssemblyDocument
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oFactory As iAssemblyFactory = oDef.iAssemblyFactory
Dim oRow As iAssemblyTableRow
If oFactory.DefaultRow.Index = oFactory.TableRows.Count Then Return
If oDef.IsiAssemblyFactory Then
oRow = oFactory.TableRows.Item(oFactory.DefaultRow.Index + 1)
oFactory.DefaultRow = oRow
End If
End If