Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm having some issues with finding the Column name of my part list.
Could anyone help me out?
Dim Invapp As Inventor.Application = g_inventorApplication
Dim doc As Document = invapp.ActiveDocument
Dim osheet As Sheet = doc.sheets(1)
Dim myBOM As PartsList = osheet.PartsLists(1)
' Get column index (hard coded for now, but doesnt work if i reorder the columns)
Dim ItemColumn As Integer = 1
Dim QtyColumn As Integer = 2
Dim PartColumn As Integer = 3
' This for-loop doesn't find the column names
' Would be amazing to get rid of this and use column(ColumnName).index instead
'For i As Integer = 1 To myBOM.PartsListColumns.Count
' If myBOM.PartsListColumns(i).ToString = "ITEM" Then ItemColumn = i
' If myBOM.PartsListColumns(i).ToString = "QTY" Then QtyColumn = i
' If myBOM.PartsListColumns(i).ToString = "PART NUMBER" Then PartColumn = i
'Next
'Loop through rows
For Each row As PartsListRow In myBOM.PartsListRows
Dim item As String = row(ItemColumn).Value
Dim qty As String = row(QtyColumn).Value
Dim part As String = row(PartColumn).Value
MsgBox(part) 'Surprisingly this works as I planned
Next
Solved! Go to Solution.